Questions tagged [add-action]

29 questions
1
vote
1 answer

add wait before add action function is run

I am sending extra Mail after new woocommerce order. I am using woo commerce_new_order hook. Problem is that when the email arrives it hasn't had product info. I think that woocommerce_new_order hook fires before everything are stored in the…
Ville
  • 105
  • 2
  • 2
  • 8
1
vote
1 answer

Class not found in add_action at static function

I'm writing a plugin for WordPress for my own website and I have an error when I try to call add_action inside a public static function class SitemapGeneratorLoader { public static function enable() { // Robots.txt request …
C. Max
  • 45
  • 1
  • 7
0
votes
0 answers

Add a way to hold a boolean value in a alert action field

In my Swift code below the goal would be that if the user hits the best friend button once it turns green and the 2nd time it reverts back to the original color. Green would signify true and no color would signify false. I don't know how to change…
0
votes
1 answer

Send an email notification incl. order details when a specific coupon code is applied in WooCommerce

I found the code below which is sending an e-mail once a specific coupon code has been used, however the order details are obviously not visible in the content since it's only the defined text: add_action( 'woocommerce_applied_coupon',…
0
votes
1 answer

Remove or edit anonymous function in WP hooks

I've added an anonymous function to an elementor hook in order to process form data: add_action('elementor_pro/forms/new_record', function ($record, $ajaxHandler) { the code... }), 10,2); It works as expected, but can't seem to edit or remove this…
0
votes
1 answer

add_action in different location - Wordpress

I have a function that when it comes to calling from another plugin I call it this way add_action( 'du_postSaveEvent', [ 'Lever\Api\Providers\ShareService', 'postSaveEvent' ], 10, 3 ); This works while in a plugin…
Edu Rafael
  • 51
  • 5
0
votes
0 answers

add_rewrite_rule not working with custom post type

I am trying to follow the examples in the wordpress documentation about add_rewrite_rule and add_rewrite_tag. I'm using a custom post type called "panel". so the pages look like "site.com/panel/post-slug" url queries work: for example I have 2: var1…
0
votes
2 answers

Woocommerce , add_action conditionally

Precisely speaking, I want to change the place of breadcrumbs in category pages. so I check if it is_product_category() and then remove_action ('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ) and add_action(…
0
votes
1 answer

Serial Number from custom table not appear in woocommerce_email_before_order_table action

I have a custom table with serial numbers in WordPress. I have successfully got the serial number to appear on both Order received page after testing with Stripe: https://prnt.sc/9tz8i3BW7lJR and it also appears on WooCommerce Admin Orders…
Schmutly
  • 1
  • 2
0
votes
0 answers

PHP 8 and 8.1 critical failure on hooking an undefined function in WordPress no error log

I just upgraded a WordPress site from 7.4 to 8.0 and in 8.0 got a critical error notice. I enabled debug and debug logging and there was no error display or error logged. After troubleshooting through the plugins and theme I found an undefined…
AJD
  • 371
  • 4
  • 14
0
votes
1 answer

create conditional priority in add_action

For a plugin, i am trying to set a different priorirty when adding an element to de admin menu bar. For administrators, it is another position then for all other user roles. I tried to define the priority as a variable in another function, return…
Webdever
  • 485
  • 5
  • 17
0
votes
1 answer

Execute add_filter inside add_action or is it possible to combine them?

I need to add a script to the footer if a product is added to the cart. When a product is added, it goes to the checkout page. So here on the checkout page, I need to insert the script. (Only once, when added. It will not show up after reloading the…
wp-ap
  • 109
  • 1
  • 8
0
votes
1 answer

How to run script only once when a product added to the cart in WooCommerce?

When a product is added to the cart, the page goes to the checkout page. Here on the checkout page, I want to add a script to the footer only once when a product from a certain category is added. I mean when to reload the page it will not show…
wp-ap
  • 109
  • 1
  • 8
0
votes
1 answer

Wordpress wp_enqueue_script Not inclode js file

I'm developing a theme and trying to get wp_enqueue_script to work. But it is not included, except that the CSS file is working. I have this function: function KYT_admin_scripts($dir) { if('toplevel_page_KYT' != $dir){ } …
0
votes
0 answers

Wordpress Plugin: add_action function seems not to be called

I lightened up one of my plugins to the maximum (which does several things), but in this specific case it only has to deal with a simple "maintenance mode". I was testing the plugin on a fresh Wordpress installation (5.9.3), but the function…
WhiteLine
  • 1,919
  • 2
  • 25
  • 53
1
2