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)
- How to properly refresh page after form action?
- Init action and refresh page after form action
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- Way to redirect all Product Sub Category to its Main category Page?
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Create a Woocommerce product widget with category filter
- Delay a function, any function!
- 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
- Insert Content Before div#main from the functions.php File
- How add body_class from wp_termmeta
- 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 in using Customizer
- 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
- How do I find the code executed when wp_head() is called?
- template_redirect action only firing if logged in
- Woocommerce Variable Product Dropdown for Custom Shop Template
- How to use wp_enqueue_script properly?
- How to hide content on mobile in the functions.php file – woocommerce
- Woocommerce Default sorting product by product type
- How to hide WooCommerce product title and short description to non logged in users?
- How to add custom metakey to shop_order page’s searching function?
- localize_script but data changes dependent on product ID
- Using get_terms for custom taxonomy in functions.php
- Changing the HTML of notices in WooCommerce [closed]
- Change class woocommerce on function.php
- Show ‘Add to Cart’ on Out of Stock products
- 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
- How to Override Page Template if URL matches query?
- Save_post – Warning: Cannot modify header information
- What is the earliest Hook a Script can use?
- removing description tabs – single product page – breaks footer
- How do I trigger WP CLI DB export using a PHP function?
- If has action not working as expected
- Link product attribute value to a URL – woocommerce
- Modifying a WordPress Plugin
- Remove text after a dot and a colon in Woocommerce product title
- post value to function with Ajax and jQuery
- When are the user meta fields created in the database? Admin vs Woo API REST
- Is_Page doesnt detect my page
- 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
- is_product_category(‘Services’) not working
- Problems adding a new field to product in cart
- Parent category as WOOCommerce Categories widget title
- Woocommerce Display Discount On cart
- Problem with my footer after changing WooCommerce Products Sorting [closed]
- How to show only specific category post by user role without plugin and restrict all other cats
- Postback redirect through add_action is not triggered
- use add_action in a shortcode (gravity form – WordPress)
- wp_footer hook causing text to show on bottom of page
- Remove action hook from Class, understanding OOP
- Variable function names
- Override plugin function to show invoices even if not logged in
- How to change form action of wp-login page with a function
- Woocommerce – Switching Price for Category
- how can I change the read more link destinations and direct all to the same page?
- Woocommerce custom calculation function
- button to toggle css styling / div visibility?
- add product thumbnail to checkout page only and include variation name
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Execute jQuery with custom event listener after successfully add an item to the cart
- Move product attributes after summary on single product page
- Show number of sold products but be first for less than 2
- function syntax is off,
- WordPress hooks to call a function inside a construct
- True parameter but jquery register in header and not in the footer with wp_register_script
- Fatal error: Call to undefined function add_action() – an untouched problem
- Sending Messages Back to the Template After Processing?
- Pass arguments to function class with do_action()
- previous_post_link inside of a function?
- Insert menu into theme location depending on user logged in/out status
- custom COOKIE on custom page
- What add_action reference should I be using or should I use do_action?
- Getting error while trying to use custom comment function
- Settings in functions.php used by a plugin
- function to return comma separated list of meta values
- Do something when user creates post (that’s pending)
- Display post_meta-by_key on product catalogue
- Get term count on a category page
- Woocommerce – Checkout error message
- reusing code in function and running it with loop
- Which template file to edit to edit homepage in Mystile [closed]
- “woocommerce_output_related_products” not working
- HELP: Code To Check Status And Write Debug Entry
- woocommerce_sort_product_tabs() expects an array