Remove action within a class in a parent theme’s includes folder from the child theme

Thanks a lot to Nathan Johnson: The solution was to use instance of the class the action was defined in. The class was globalized in the theme after instantiation. So the adding the below code to functions.php of a Child Theme worked: function remove_woo_forms_hooks() { global $woo_a; remove_action(‘woocommerce_before_customer_login_form’, array($woo_a,’before_customer_login_form’)); } add_action( ‘after_setup_theme’, ‘remove_woo_forms_hooks’,0);

Automatically set post_parent value

You can do that easily using save_post hook like so: function set_post_parent_on_save($post_id) { // If this is just a revision, don’t do anything if ( wp_is_post_revision( $post_id ) ) return; // Check if it is a post if ( ‘post’ == get_post_type( $post_id ) ) { // unhook this function so it doesn’t loop infinitely … Read more

Filter WooCommerce archive pages by an additional category

you need to add your topic to query_vars. function so306156_add_query_vars_filter($vars) { $vars[] = “topic”; return $vars; } add_filter(‘query_vars’, ‘so306156_add_query_vars_filter’); and then, in pre_get_posts, you check for that var and act accordingly: function so306156_manipulate_main_query($wp_query) { if (function_exists(‘is_woocommerce’) && !is_admin()) : if ($wp_query->is_main_query() && is_woocommerce()) { if (isset($wp_query->query_vars[‘topic’])) { $tax_query = $query->get(‘tax_query’); $tax_query[] = [ ‘taxonomy’ => … Read more

How to remove a class function from a plugin by using remove_action()?

[ Nova_Restaurant::init(), ‘sort_menu_item_queries_by_menu_order’ ] You want something of type callable, that matches what was given when add_action. There are only a handful of valid callables: [ ‘my_function_name’ ] aka my_function_name(); [ ‘my_class_name’, ‘my_static_function’ ] aka my_class_name::my_stati_function() [ $object, ‘the_objects_function’ ] aka $object->the_objects_function [ function() {} ] an anonymous function or closure So some translation: remove_action(‘parse_query’,’WM_Nova_Restaurant’, … Read more

400 Bad Request – JavaScript App calling Custom wp-json endpoint

There were three problems I discovered with my code above. First, $_SERVER[“HTTP_REFERRER”]; is an undefined index, moreover it is mispelled – HTTP_REFERER would be correct if it could be accessed this way in WP. I found get_http_origin() instead. $data[‘UrlReferer’] = get_http_origin(); Second, I also mispelled the field I was saving this variable to – UrlReferrer … Read more

Woocommerce – Adding row to cart table

You already have the right “action”, which is woocommerce_after_cart_contents. But when I tried the markup you used: function quality_certificates(){ echo ‘<tr>TEST</tr>’; } this was the visual output: (I actually initially tested with the Twenty Seventeen theme; sorry about that. But this one is tested with Storefront) Then I started thinking that the problem might be … Read more