I'm trying to override a parent theme filter in a child theme; I must have the syntax wrong as the override is being completely ignored. Here's what's in my child theme's functions.php:

//* remove and replace parent filter
function child_remove_parent_function() {

//* my custom function
function child_function($link){
    //* function code here
    return $link;

The child theme is definitely in use - I initially tried copying & customizing the function and got the 'cannot redeclare function' error. Just not sure why I can't replace the filter.

I even tried leaving just

function child_remove_parent_function() {

to see if the outputted link would break but that didn't do anything either. What am I missing?

1 Answer 1


I do not see you actually calling child_remove_parent_function() in your code.

Another issue to be aware of is timing. It is counter–intuitive, but functions.php files are loaded in order of child first, parent second.

Overall you need to ensure two things:

  1. code works at all
  2. it is called at the appropriate moment, after parent theme is done with its set up
  • OK - would I just need to add add_action( 'after_setup_theme', ' child_remove_parent_function' );? Oct 5, 2015 at 13:23
  • I'm totally confused now. I know I can do this by editing the parent theme but that would be overridden by an update. Calling child_remove_parent_function() in my child theme's functions breaks the site. Oct 5, 2015 at 13:37
  • Tried function child_remove_parent_function() { remove_filter('filter_name','parent_function'); } add_action( 'after_setup_theme', 'child_remove_parent_function' ); but still no dice. Can I get some help from someone? Oct 12, 2015 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.