Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

2

Is it possible to bind a function to a filter hook via Ajax? No, because page requests are self contained. When you request something from PHP, everything gets loaded from a fresh clean slate. At the end of the request, that slate is discarded. This is different from say a Node application that is always running. So, if you make an AJAX request and ...


1

WooCommerce itself isn't setting fresh_site to 0 directly (the string fresh_site doesn't appear anywhere in WooCommerce's source code), however you are correct that it's happening because WooCommerce is creating pages. WordPress sets a site to not be fresh like this (from wp-includes/default-filters.php): // Mark site as no longer fresh foreach ( array( '...


1

My include has a handful of custom hooks which handle enqueuing, dequeuing and inserting custom HTML. I'm still not 100% certain what you mean, but if this code is normal WordPress code, with functions and add_action(), and you only want those hooks to run on these events pages, then the proper way to do this would be to include that file into your theme's ...


1

WordPress redirects you back to the user-edit.php page upon successful user update, so while the admin_notices has yet been fired in your sulock_save_profile_fields(), the message (your custom admin notice) is never displayed because of the redirection. And one way to fix it, is by filtering the redirect URL via the wp_redirect filter: // In ...


1

You're missing a ' in your code and your function name is different. function my_maybe_add_redirect( $entry, $form ) { wp_redirect( 'https://www.google.com/', 301 ); exit(); } add_action( 'admin_post_submit_images', 'my_maybe_add_redirect', 10, 2 );


1

When customer returns from a gateway without paying, it falls on order received (thankyou) page with 2 possible status: failed or pending, and there is 2 possible action hooks: woocommerce_thankyou_{$order_payment_method} (composite hook with $order_id available argument) woocommerce_thankyou (with $order_id available argument) You can target that case ...


1

My guess is that the shipping method isn't initialised when you make an ajax call. Try moving your actions directly into your init function. EG: function checkAjax(){ print_r($_POST); exit; } function dhlsweden_shipping_method_init() { //use checkAjax since you don't have access to your shipping method class. If this is the case then you need ...


1

Based on class-wc-admin-list-table-orders.php (order column on line 173) there doesn't seem to be a filter to change the markup. To circumvent this, perhaps you could add a js/jQuery script, to admin_footer or with admin_enqueue_scripts, which either adds the necessary class(es), removes href or changes it to #, or with some event delegation wizardry have ...


Only top voted, non community-wiki answers of a minimum length are eligible