When would it be best to hook AJAX functions on a back-end page?
When would it be best to hook AJAX functions on a back-end page?
When would it be best to hook AJAX functions on a back-end page?
Something like this, I believe: $args = array( ‘number’ => -1, ‘hide_empty’ => false ); $product_categories = get_terms( ‘product_cat’, $args ); foreach( $product_categories as $cat ) { if ( $cat->count <=1 ) { wp_delete_term( $cat->term_id ); } }
Adding an action doesn’t do anything except putting the callback function in the queue of the corresponding hook. It doesn’t check if the function exists, let alone load a file where the function is resident. Only when the corresponding hook is fired PHP looks for the function. If it is not loaded by then it … Read more
WooCommerce has its own hooks for things like this. You shouldn’t rely on the underlying WordPress post-related hooks and functions when dealing with products and orders. WooCommerce is moving towards using custom database tables for products and orders instead of custom post types and while there’ll be hooks etc. added for backwards compatibility, you’ll be … Read more
Plugin Development – Call to undefined function comment_exists()
is_page not triggering
I don’t think the filter will work in your template, since you’re using wc_price( wc_get_price_including_tax( $product ) ) .. a possible workaround: function pr_price_suffix( $price, $product ) { return wc_price( wc_get_price_including_tax( $product ) ). ‘ test’; } add_filter( ‘woocommerce_get_price_html’, ‘pr_price_suffix’, 10, 2 ); and in your single-product.php template: <?php echo $product->get_price_html(); ?>
I’ve been working on a similar problem, so found a possible solution. The issue is the ‘inline’ images, as opposed to images that are attachments (like a gallery), is that there is no filter for the_content() that deals specifically with the images tag. (At least, I haven’t found it yet.) So, you need to use … Read more
Sally CJ raises a good point in their comment that it is probably better to have each class initialize its own actions and filters. I’ve been working with the same boiler plate for some time now and created my own version of this boiler plate on GitHub. In that version I have a Back\Hooks and … Read more
Use the password_reset hook. function wpse_password_reset( $user, $new_pass ) { //* Do something useful with $new_pass } add_action( ‘password_reset’, ‘wpse_password_reset’, 10, 2 ); Edited to add after the comment: Looks like the reason I can’t use that is that the plugin uses wp_update_user to set the new password. Is there any way I can intercept … Read more