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
- 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
- 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)
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- Failed to invoke other hook from the init hook
- Very stubborn wp_register_script / add_action vs remove
- How does WooCommerce display a custom comment_type in Comment Admin?
- do_action and hook methods
- Is it possible to add an action to the currently running action?
- Custom preview_post_link not working for draft post
- Action on post publish
- How to add inline css/js inside a shortcode
- Determine plugin name from within plugin_action_links filter
- How to call bind function in wordpress actions or hooks
- Woocommerce – Hide a Column in Cart Table
- How to remove the woocommerce_checkout_process action hook in woocommerce if particular project in cart [closed]
- ‘wp_login’ action hook not working with wp-login.php file
- 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
- 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 stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Fetch Children of Grouped Products Inside WooCommerce Product Loop
- Passing an array from shortcode-function to filter-function
- custom payment gateway in woocommerce failed to connect to remote api server
- 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?
- how to do login using woocommerce rest api From android
- WordPress user account activation
- External Script Using WP – Hooks / Actions Not Working?
- add_filter doesn’t work
- How can I insert thousands of Woocommerce products by batch with PHP? [closed]
- 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?
- remove_action not removing add_action from constructor
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- Add a “View all” button on WooCommerce product archives pages
- Cross Sells are not being shown in Cart Page. Please Help!
- How to remove products-links after the product title using remove_action
- WordPress custom plugin that uses woocommerce enabled payment gateway for payment [closed]
- Disable variations on woo commerce if out of stock
- Add a function call after content automatically?
- what is the point of telling add_filter how many parameters you want passed to the function?
- How to add filter for wordpress plugin?
- How to add category and subcategory in WordPress custom code?
- How to hook into action/filter call
- Edit post image attributes on fly?
- Add hook after content without formatting
- wp_query ‘s’ parameter does not work with WC_AJAX
- Grouping imported products and showing variations based on selected product
- Remove Zero Money From Previews Order woocommerce
- How would I Redirect an existing WooCommerce customer to a specific url after Checkout
- Make downloadable ebook read online without download option
- Why do actions with class and public method don’t fire __construct()
- Woocommerce convert simple products to variations
- How to create a plugin with automatic update?
- Getting all woocommerce products from REST API call in plugin
- WooCommerce Product Table – filter query on attributes
- Disable WC Bookings automatic order completion [closed]
- In woocommerce, is there any way to empty wordpress default mini cart when order placed?
- Get a list of Product Categories inside a loop
- wc_get_product_terms() throws “Notice: Undefined offset: 0”
- Woocommerce list variations that are added already to cart in Single Product
- {status}_{post_type} does not run correctly?
- Not displaying Woocommerce product page in lightbox
- Using multi-dimensional array with filter
- WordPress Reset password Strength set to medium
- Hide ‘add to cart’ button for some products [duplicate]
- Change pricing in Woocommerce based on Category and Product [closed]
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- Passing a parameter to filter and action functions
- Filter for modifying image on upload
- add query string to all pages after user logged in
- How wordpress plugin hooks works? [duplicate]
- The plugin generated xxx characters of unexpected output during activation
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- Predefine Product Variations for specific custom product type [closed]
- Create Custom Coupon Type
- Unable to pass arguments from plugin form to filter hook using ajax, the data is transferring via ajax but unable to pass as arguments in filter hooks
- How to use `$order->get_discount_total()`, avoiding defoult WC decimal rounding?
- A multi-section WordPress store [closed]
- add_action() not working for admin
- WooCommerce Attribute Mapping
- How to customize WP_Error (REST JWT authentication plugin) [closed]