I am learning WordPress from a book and while learning about how to use action hooks the author gives the…
enqueuing React script and hooking its target div fails to load script
I am getting a silent failure on the below code as I try to enqueue a static React.js script and…
add_action with associative array
I am trying to get these parameters from the do_action: do_action( ‘woocommerce_simple_auctions_outbid’, array( ‘product_id’ => $product_id , ‘outbiddeduser_id’ => $outbiddeduser,…
How to list all WC products by their attributes values?
i wanted to get some advise on how to list all my inventory attributes values. I have this simple code…
Instantiating classes through add_action and saving them to user_meta data
In my WordPress.com site I have a form where users can add relationships of different types (coworkers, friends, etc.) and…
trying to add extra field using hooks
I am trying to add an extra field on the backend menu of Edit Subscription menu (SUMO Subscription (plugin) ->…
Use action, filter, or hook to append HTML to WordPress plugin function
I am new to WordPress actions, filters, and hooks, and am wondering if it is possible to use one of…
How to load template dynamically on custom URL without creating page?
add_action(‘plugins_loaded’, function() { $url_path = trim(parse_url(add_query_arg([]), PHP_URL_PATH), ‘/’); if ($url_path === ‘free-trial’) { $load = locate_template(‘template-free-trial.php’, TRUE); // exit if…
How to show only specific category post by user role without plugin and restrict all other cats
I am using basic post for adding posts. 5 categories exist ( cat_A, cat_B, cat_C, cat_D, cat_E). And I have…
Use wc_enqueue_js only on specific pages
In my plugin, I’m trying to add inline script using wc_enqueue_js only on the cart page. The rest of the…
Use wc_enqueue_js only on specific pages – nested add_action
In my plugin, I’m trying to add inline script using wc_enqueue_js only on the cart page. The rest of the…
Best hook for when a user session ends?
I’m creating a backend feature that calculated user’s login sessions during the past 2 weeks. This is easy enough to…
why require – does not load filter
I am using the boilerplate for WordPress plugin : https://wppb.me/ but I don’t know if it’s because of there coding…
add_action doesn’t work for my function
I’m trying to build a function which run when a member is registering on my site. Here’s the function :…
2 list tables under two tabs, bulk actions is not working
I have to list tables extending a backup of WP_List_Table. Each list table is displayed under a tab. The list…
Check custom User meta before Insert
My goal is to check if my custom user meta field ‘subscribe_to_newsletter’ has been changed. If so i will be…
add_action(‘init’) not work
my code is add_action(‘init’, ‘user_logged_in’); function user_logged_in(){ if( is_user_logged_in() && is_page(‘login’)){ wp_redirect(home_url()); exit; } } the page slug and name…
Action init not firing after update WP 5.2.2
I recently updated my website to WP 5.2.2 and ‘init’ action seems not to fire anymore.. I had few VC…