I'm trying to remove a parent theme's add_action call to a pluggable function, but can't get it to work by calling remove_action()
- I have to redeclare the function and just leave it empty. Is this normal? I'd think I could use remove_action
to simply never call the function.
Here's the parent theme code:
add_action( 'tha_content_while_before', 'fwp_archive_header' );
if ( !function_exists('fwp_archive_header') ) {
function fwp_archive_header() {
// do stuff
}
}
And in the child theme (NOT working):
add_action( 'init', 'remove_parent_actions_filters' );
function remove_parent_actions_filters() {
remove_action( 'tha_content_while_before', 'fwp_archive_header' );
}
I have also tried swapping out 'init
' for 'after_setup_theme
' and 'wp_loaded
'; I've also tried lowering and raising the priority, nothing worked. The only thing that did work was this:
In the child theme (working):
function fwp_archive_header() {
// do nothing
}
Can that be right, I have to redeclare the function to get rid of it?
Thanks!
remove_action
outside of the 'remove' function? On its own in your child theme > functions.php ? Just guessing...remove_action
can be tough.