I solved the issue by putting all the actions and filters inside plugins_loaded which fires very early. Like this:
add_action('plugins_loaded', function(){
if ($this->is_user_b2b()){
add_action(.....
add_filter(.....
Related Posts:
- Where is the best place to use add_filter
- How to prevent action in ajax request, when in admin side?
- Get Time Taken By Each Action Hook in WordPress
- Redirect to another page using contact form 7? [closed]
- How to use add_action for multiple instances of the same class
- How to append new form elements in “Add New” form of Users in WordPress admin panel?
- Nested Actions and Filters
- Remove action added in plugin class from theme
- Help needed with woocommerce (wc stripe) filter
- wp_head filter not executed inside custom class
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- How to only hook on Single.php after content?
- When can you get current page ID and initialize hooks right after?
- Edit plugin without hooks in functions.php
- WP WC CLI – WooCommerce setup store with wp-cli [closed]
- Using the ‘draft_to_publish’ hook (post status transition)
- Using add_filter inside another class
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How can I limit functionality in one version of a plugin?
- Shortcode display outside the div
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- Use external link in the add sub menu
- Pass A Value From Outside To A Plugin Variable
- Failed to invoke other hook from the init hook
- Very stubborn wp_register_script / add_action vs remove
- How to prepend to the_title for admin-side plugin’s use
- How does WooCommerce display a custom comment_type in Comment Admin?
- do_action and hook methods
- How can I filter blog name?
- Can a plugin add to header/footer/body content?
- Is it possible to add an action to the currently running action?
- Custom Shipping method not showing in checkout
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- Custom preview_post_link not working for draft post
- Action on post publish
- How to add inline css/js inside a shortcode
- Woocommerce Shipping module available only for type of products [closed]
- Add Fields with Sub-Fields to WP Job Manager
- Determine plugin name from within plugin_action_links filter
- How to call bind function in wordpress actions or hooks
- merging an array to an existing array using add_filter
- Woocommerce – Hide a Column in Cart Table
- What is the purpose of $merged_filters?
- template_redirect not being called when using ajax
- Create or Update thousands of woocommerce products via PHP
- add action wp_head not working
- What are the benefit in adding hook in the init() hook?
- HTML in WooCommerce settings
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- Woocommerce plugin for minimum order and add-to-card-step
- Automatically add attributes to woocommerce product?
- Any hook for pre-plugin-update -either bulk or single plugin update
- wordpress plugin is not activating from widget
- Creating a plugin to sanitize comment and the url field before display only
- When to load auto-login code?
- How to find the origin of a file upload from within wp_handle_upload?
- How to get all of the activate_plugin action parameters?
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- woocommerce payment gateway callback not firing [closed]
- How to modify WCMP Rest API response?
- Fetch Children of Grouped Products Inside WooCommerce Product Loop
- White page by using filter template_include
- Woocommerce dependent plugin
- New databes tables with – WooCommerce – for developers [closed]
- Create a navbar filter that filters by a custom field
- Change commission_status paid when withdraw_status vendor is completed
- Passing an array from shortcode-function to filter-function
- custom payment gateway in woocommerce failed to connect to remote api server
- CampaignMonitor for WooCommerce – Move subscribe button [closed]
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Filtering WooCommerce Orders by Category
- Plugin developer automated documentation
- qTranslate remove default directory from link
- Custom plugin init action causing general slowness
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- how to do login using woocommerce rest api From android
- Woocommerce Minimum Price for a Composite Product to add in cart
- WordPress user account activation
- External Script Using WP – Hooks / Actions Not Working?
- How to change the name of the “edit my profile” link in the WordPress admin backend
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Proper way to replace the_content only for pages created by custom plugin
- add_filter doesn’t work
- How can I insert thousands of Woocommerce products by batch with PHP? [closed]
- Add action to fire when a published post is updated
- Is there a way to figure out which action/filter invoked a function?
- How to pass variables to a function argument using add_action [duplicate]
- Using add_action before add_filter on a plugin?
- Check if variable is set in filter
- Submit Form data to another page via Ajax (WordPress Way)
- Does using `add_action( ‘init’…` cause performance issues?
- Check filter defined or not?
- remove_action not removing add_action from constructor
- Hook for page Request?
- Editing wp-config.php