• Resolved dougjoseph

    (@dougjoseph)


    Hello. I recently updated the WordPress core from 5.7.2 to 5.8, after backing up everything and after updating plugins and themes. This was on a multisite network. One of the sites uses a Child Theme based on the TwentyTen theme. I dutifully also ran the “update network” option. I instantly got the infamous White Screen of Death on the one site in focus. When I finally located the PHP error log, the pertinent entries were along these lines:

    PHP Warning: require( ~ /public_html/ ~ /wp-content/themes/ ~ child-theme/block-patterns.php): failed to open stream: No such file or directory in / ~ /public_html/ ~ /wp-content/themes/twentyten/functions.php on line 743

    I had the presence of mind to notice the key was likely “block-patterns.php” — however, when I googled using terms such as…

    TwentyTen Child theme PHP Warning block-patterns.php

    …I got nothing related to speak of. I quickly sleuthed out that the issue was not in the child theme’s functions.php file, but rather in the parent theme’s functions.php file. Finally, I noticed it was calling for the existence of a new code file, block-patterns.php, but it was calling for its existence inside the child theme, not just the parent theme!

    I solved this by simply making a copy of the newly existing file, block-patterns.php, in the parent theme, and moving that copy into the child theme. Problem solved. I hope this helps anyone else facing the same issue.

    • This topic was modified 3 years, 4 months ago by dougjoseph.
    • This topic was modified 3 years, 4 months ago by James Huff.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dougjoseph

    (@dougjoseph)

    Reposting the last paragraph here, simply to be able to “reply and mark as resolved.”

    I solved this by simply making a copy of the newly existing file, block-patterns.php, in the parent theme, and moving that copy into the child theme. Problem solved. I hope this helps anyone else facing the same issue.

    I suspect the developers will fix this eventually, so I recommend altering the file in the parent theme, /wp-content/themes/twentyten/functions.php by changing line 743 from this:

    
    require get_stylesheet_directory() . '/block-patterns.php';
    

    to this:

    
    require get_template_directory() . '/block-patterns.php';
    

    The function get_template_directory() will “[i]n the case a child theme is being used, the absolute path to the parent theme directory will be returned,” which will resolve the error for now, and won’t leave you with a potentially outdated copy of block-patterns.php in your child theme folder.

    Once the developers release a fix, the edited file will be overwritten, and you’ll be all good.

    Thread Starter dougjoseph

    (@dougjoseph)

    To all who were helped: I’m glad, and I also encourage taking note of the more “future proof” way of fixing it pointed out by @linux4me2

    It looks like this has been fixed in the codebase as of earlier today.

    • This reply was modified 3 years, 4 months ago by zaneselvans.
    Thread Starter dougjoseph

    (@dougjoseph)

    @zaneselvans

    It looks like this has been fixed in the codebase as of earlier today.

    Cool. Just out of curiosity, approximately how long does it usually take for a fix to eventually be released in a new version of a theme?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘SOLVED: TwentyTen Child theme PHP Warning block-patterns.php’ is closed to new replies.