add_filter not works in ajax
add_filter not works in ajax
add_filter not works in ajax
When would it be best to hook AJAX functions on a back-end page?
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
Unhook a function within a class in the child theme
You could try: add_action( ‘plugins_loaded’, function() { global $basic_user_avatars; remove_action( ‘edit_user_profile’, array( &$basic_user_avatars, ‘edit_user_profile’ ) ); }); You need to make sure this is done after the other plugin has been initialized, therefore the plugins_loaded action.
Remove this line add_action( ‘wp_ajax_my_action’, ‘updateContent’ ); Add this two Line add_action( ‘wp_ajax_nopriv_updateContent’, ‘updateContent’ ); add_action( ‘wp_ajax_updateContent’, ‘updateContent’ ); hopefully it will solve your issue https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_nopriv_(action)
The solution was given by Fabian Marz. I remove the default parameters and added one variable in the function call.
SOLVED: I used the premium plugin “Woocommerce Extra Product Options” (https://themehigh.com/product/woocommerce-extra-product-options) Thanks
adding an action inside if condition not working
Follow standards instead of ugly solutions. Use WP filter (put inside functions.php): add_filter( ‘site_url’, ‘my_url_modifier’, 10, 4 ); function my_url_modifier( $url, $path, $scheme, $blog_id) { if($url==’http://mywebsite.com/wp-login.php?action=lostpassword’) return ‘http://your_link..’; else return $url; } p.s. You should add other links there link example. Also, you can sanitise further parameters, like : if ($path==’wp-login.php’)….