Remove action in a parent theme from the child theme

My question is how do I remove the action hook in the parent from the child theme?
Code from my parent theme:

if ( ! function_exists( ‘wm_menu_social’ ) ) {
function wm_menu_social() {
get_template_part( ‘template-parts/menu’, ‘social’ );
// if i place a comment here, social links won’t display
}
}
add_action( ‘tha_header_top’, ‘wm_menu_social’, 130 );

I tried adding each of these 3 possible add_action() individually from my child theme but didn’t work:

add_action( ‘after_setup_theme’, ‘wm_remove_menu_social’, 0);
//add_action( ‘init’, ‘wm_remove_menu_social’);
//add_action( ‘wp_head’, ‘wm_remove_menu_social’);

function wm_remove_menu_social() {
remove_action( ‘tha_header_top’, ‘wm_menu_social’ );
echo “TESTER”; // this prints but remove action doesnt work.
}

As shown above, I tried to add a comment to the parent & it worked. But, we all know that the parent theme should not be touched for future updates.
I’ve searched this problem but nothing seemed to work. Sorry guys, I’m still a bit new to the WordPress API. I have created very few basic WP plugins. Thanks in advance.

Read more here:: Remove action in a parent theme from the child theme

Leave a Reply

Your email address will not be published. Required fields are marked *