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

New answers tagged

0

I managed to solve this issue using pre_get_termsas an action and then updating the query_vars $current_user = get_current_user_id(); $user_field = "user_".$current_user; $user_categories = get_field('post_categories', $user_field); if(in_array('category',$terms->query_vars['taxonomy'])){ $terms->query_vars['include'] = $user_categories; } ...


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

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 ...


0

I would start by making this part a plug-in for the theme. Then, look at all the code the source plugin provides. I am unfamiliar with this one but it looks to be ok. Find the actions and filters it introduces and use those to build your plugin. In fact I think on init you could do certainly add content.


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 ...


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

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 );


0

Filter should modify the given value and return it. It should not print anything. But your foreach loop does exactly opposite - it prints its output and doesn’t append anything to result. So when you use it to append its result to the content, it prints its result and doesn’t return anything - so nothing gets appended. One way to fix it is to use buffering:...


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 ...


0

You can catch specific status change by using this action hook 'woocommerce_order_status_{status}'. It is defined in the WC_Order class. This is how you define it: /** * Executed when the status is changed to failed. * @param int $order_id * @param \WC_Order $order */ function wpdg_9291_woocommerce_order_status_failed( $order_id, $order ) { // Do ...


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 ...


Top 50 recent answers are included