you're too far away ... one of the problems that may arise is that you are trying to remove the hook before it is added by your parent theme. The class can be initialized at a later stage ...
im not too sure when your hook is working, but hopefully after init
add_action('init', 'remove_parent_hook'); function remove_parent_hook(){ remove_action( '__colophon' , array('TC_footer_main','tc_colophon_center_block') , 20);
now you can just add an action for your new function.
There is a note that an anonymous function has been added, the &$this value is often ignored when trying to delete a connected function. This is a pain because wp will assign a random string as the key name and function name for this function, each time it is not guessed. But we can look for the function name inside the key, so something like this will work
function remove_anon_hk($hook, $function, $priority=10 ){ global $wp_filter; $hooks= $wp_filter[$hook][$priority]; if(empty ($hooks)) return; foreach($hooks as $hk=>$data): if(stripos($hk, $function) !== false ){ unset($wp_filter[$hook][$priority][$hk]); } endforeach; } add_action('init', function(){ remove_anon_hk('__colophon', 'tc_colophon_center_block'); });
source share