I would like to overwrite some content which is located in (inc/) template-tags.php file on parent theme.

Content need to be changed is in function footer_content_widget_area in template-tags.php file and that function is called on functions.php:

add_action( 'page_widgets', 'footer_content_widget_area' );
  • How does the parent theme load the file template-tags.php?
    – Milo
    Mar 13, 2017 at 16:25
  • It is loaded in custom function in functions.php. Mar 13, 2017 at 18:45

2 Answers 2


In functions.php child theme include template-tags.php from parent theme:

require_once get_theme_file_path( '../parent-theme/inc/template-tags.php' );

In the child theme template-tags.php remove parent action and add the child action replacing it:

remove_action( 'tag', 'parent-function', 0 );
add_action( 'tag', 'new-child-function', 10 );

As long as you have a child-theme setup correctly then you just allow the child-theme to replace the parent-theme template by placing the template file in the same location.

So based on the location that you mention in your question you would simply place your edited copy of the template-tags.php in the location child-theme/inc/

the wordpress way of things is explained in the Template_Hierarchy (https://developer.wordpress.org/themes/basics/template-hierarchy/).

Your Answer

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

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