I have modified the theme.php file located in the parent theme in the "Includes" folder, and I have placed it in the child theme also in the "Includes" folder, but my changes are not included. WordPress only reads the file placed in the parent theme folder. What is the reason for this? What should I do the modifications are included when the file is located in the child theme folder? Alternatively, how can I override a function from includes/theme.php in functions.php? I can’t override the function because there’s a redeclaration error.

Edit 7.05.2020

@JacobPeattie - Thanks a lot. I read it. I don't know if I understand it all right. My English isn't very good yet. I wrote so in functions.php:

if ( ! function_exists( 'bimber_capture_entry_featured_media' ) ) :
function bimber_capture_entry_featured_media_my_modifications( $args ) {

//function code with my modifications


It was successful added, but doesn’t work.

Maybe it’s usefull information:

  1. File theme.php is added in functions.php file in parentTheme/includes folder in this way: require_once BIMBER_INCLUDES_DIR . 'theme.php';

  2. Function is called by ‘echo’ in another function.

Here are php files:

  • 2
    No, child themes don't automatically substitute included files like that. You also can't undeclare a function to replace it - at least not without something like runkit, but I wouldn't go down that route. What behaviour are you trying to change? Are there any hooks provided in the theme that you can use?
    – Rup
    May 6, 2020 at 8:31
  • 4
    Does this answer your question? override parent theme configuration in child functions.php May 6, 2020 at 8:36
  • @Rup and Jacob Peattie. Thanks for your answers. I edited my question.
    – reti
    May 7, 2020 at 11:24
  • 1
    bimber_capture_entry_featured_media_my_modifications - you'd have to give it exactly the same function name. But unless the function is also pluggable in the parent theme this won't do any good. (I'd have expected the parent theme would be loaded first but I think I'm wrong and the child is loaded first.)
    – Rup
    May 7, 2020 at 11:38

1 Answer 1


You want to replace bimber_capture_entry_featured_media in your child theme. In the theme.php file you've given us you can see that this is only called in one place, from bimber_render_entry_featured_media, and the call is wrapped in a filter:

if ( apply_filters( 'bimber_render_entry_featured_media', true, $args ) ) {
    echo bimber_capture_entry_featured_media( $args );

where returning false from the filter will cancel the call to the default code. Assuming that's true, that nothing else calls this function without the filter guard, what you can do then instead is

  1. implement the bimber_render_entry_featured_media filter; choose a low priority if there's anything else that implements this, but I don't see anything in these files
  2. in the filter call your replacement bimber_capture_entry_featured_media_my_modifications and echo the result
  3. return false from the filter to cancel the call to the original unmodified code.

e.g. (untested)

function bimber_render_entry_featured_media_filter_my_modifications( $flag, $args ) {
    if ($flag) {
        echo bimber_capture_entry_featured_media_my_modifications( $args );
    return false;
add_filter( 'bimber_render_entry_featured_media',
            'bimber_render_entry_featured_media_filter_my_modifications', 10, 2 );

However there are plenty of hooks in the original method too, so depending on what you're trying to do you might be able to use those to change the behaviour rather than completely overriding the method.

  • Thanks a lot. I think we are extremely close. Your code works, but it appears an error: "Warning: Use of undefined constant bimber_render_entry_featured_media_filter_my_modifications - assumed 'bimber_render_entry_featured_media_filter_my_modifications' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\wordpress\wp-content\themes\bimber-child-theme\functions.php on line 409"
    – reti
    May 7, 2020 at 12:30
  • 1
    D'oh, sorry, yes. The function name should have been in quotes.
    – Rup
    May 7, 2020 at 13:32
  • :) :) :) Looks like it works! Thank you. You've helped me a lot. I'm really very grateful. I can't vote because I don't have enough points. I'm missing two.
    – reti
    May 7, 2020 at 13:38

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.