add_action() and add_filter() take 4 params: string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1
.
So, the function you are hooking to takes more than 1 param, then just pass the number of params it accepts as the 4th param to add_action()
. In your case,
add_action ('my_action', 'my_function', 10, 2) ;
Related Posts:
- Which method is more correct for removing WooCommerce Extensions menu item?
- add variable to actions/functions across different files (woocommerce)
- remove_action on after_setup_theme not working from child theme
- How to display custom field in woocommerce orders in admin panel?
- How to create a custom order status in woocommerce!
- Remove Actions/Filters added via Anonymous Functions
- Trying to use add_action and do_action with parameters
- Perform an action when post is updated/published
- How to show product SKU on product page
- Woocommerce add to simple product attribute programmatically [closed]
- add_action in a function, is it possible?
- Add action hook conditionally – only when home.php in use
- How can I tell if I’m on a login page? [duplicate]
- In WooCommerce I need to modify the thankyou.php page [closed]
- Change meta tags programatically
- Convert hyphen to underscore in permalinks
- Reuse variable in hook callback
- Remove product description from product archive page
- Can you use admin pages functionality on the frontend of your site
- Creating loop within functions.php
- How to update feed only 2-3 times a week (for Feedburner email)?
- Display WooCommerce subscriptions for user [closed]
- Increment price for Woocommerce Minicart [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- Passing arguments to my function with do_action and add_action is not working
- Woocommerce checkout field maxlength, make input number field only (postcode)
- Set quantity of woocommerce product on page visit [closed]
- Selective Product Category for Carousel
- Don’t delete a page if it holds users
- How do I add Bootstrap and LESS to my migrated WordPress site?
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- How to display custom option field in woocommerce orders in admin panel?
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- How to auto refresh when user change postcode
- Is there an alternative to get_template_directory_uri()?
- Wait a result before enqueue
- woocommerce change currency per category [closed]
- Multiple Loops Meta Data
- Function added using `add_action()` not being called
- jQuery does not work
- How to override woocommerce.css?
- Override the WordPress core function wp_referer_field
- Two functions with different arguments and add_actions, but identical code
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- How to change this simple code so that it sends the email notification after payment in WooCommerce?
- I can’t seem to install Font Awesome locally [closed]
- Scripts not loading when using the wp_enqueue_scripts action
- problem loading stylesheets to wp_head dynamically
- current_user_can comma list vs OR (||) list
- Woocommerce checkout field
- add referrer to woo
- How to properly refresh page after form action?
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- Create a Woocommerce product widget with category filter
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- Changing where my author box is printed
- Adding product to WooCommerce cart [closed]
- Change WooCommerce add_to_cart Button Text?
- Use add_action within template
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- Problem with custom function when I go back with the browser
- Replace admin header logo with an image
- New checkbox in custom widget isn’t saving data
- template_redirect action only firing if logged in
- Woocommerce Variable Product Dropdown for Custom Shop Template
- How to use wp_enqueue_script properly?
- Woocommerce Default sorting product by product type
- Using get_terms for custom taxonomy in functions.php
- Change class woocommerce on function.php
- Issue passing action class to nested function. Admin Columns
- Does hook have an effect on increasing the page load?
- Hide ‘add to cart’ when certain value in dropdown is selected
- What is the earliest Hook a Script can use?
- post value to function with Ajax and jQuery
- How do you insert code into the sidebar?
- How Do I Unhook This Parent Theme Function?
- price of product can’t return when get data of product in functions.php
- Woocommerce product price change
- Help with with my function for wordpress
- Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
- use add_action in a shortcode (gravity form – WordPress)
- wp_footer hook causing text to show on bottom of page
- Variable function names
- Woocommerce – Switching Price for Category
- add product thumbnail to checkout page only and include variation name
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Move product attributes after summary on single product page
- Show number of sold products but be first for less than 2
- True parameter but jquery register in header and not in the footer with wp_register_script
- Sending Messages Back to the Template After Processing?
- previous_post_link inside of a function?
- Insert menu into theme location depending on user logged in/out status
- custom COOKIE on custom page
- Do something when user creates post (that’s pending)
- Get term count on a category page
- reusing code in function and running it with loop
- HELP: Code To Check Status And Write Debug Entry
- woocommerce_sort_product_tabs() expects an array
- sort by date in users