Support » Fixing WordPress » WordPress 4.7 Fatal Error Cannot redeclare get_paged_template()

  • Resolved AcidRaZor


    Trying to upgrade, just as it finished and goes to about.php?updated it gave an HTTP 500 error

    PHP message: PHP Fatal error: Cannot redeclare get_paged_template() (previously declared in /home/public_html/wp-includes/template.php:360) in /home/public_html/wp-includes/deprecated.php on line 3774

    Server is running NGINX and PHP 7.0
    Cache is cleared (I’m not running any caching plugins)
    I restarted the server to make sure.
    I tried removing all templates/plugins and keeping just the latest as recommended
    I tried a manual upgrade and followed the instructions, same error occurs

    This is just a bit too much. A live site with thousands of visitors is sitting broken now. Brilliant.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator James Huff


    Volunteer Moderator

    That appears to be related to and would therefore be a problem with your theme using a very old and deprecated function.

    For now, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel, navigate to /wp-content/themes/ and rename the directory of your currently active theme. This will force the default theme to activate so you can use your site.

    Then, I recommend getting in touch with the theme’s developer.


    Thanks for your report!

    In WordPress 4.7, get_paged_template() was moved to wp-includes/deprecated.php. The fatal error could be caused by PHP’s internal OpCache or an incomplete update.

    Since you’ve already tried a manual upgrade, OpCache is more likely. It’s an internal cache, not a caching plugin or something external. To flush the OpCache, you could do this:

    1. Create a new file, flush_opcache.php, in the same directory as wp-config.php and wp-content.
    2. Open in your browser
    3. Delete the file again
    4. Visit your dashboard to see if the error still occurs

    Let me know if that works or if you do not have (S)FTP access and need to find another way to test this.


    Moderator James Huff


    Volunteer Moderator

    Nice OpCache flush trick @swissspidy, thanks!

    Oops, I forgot the most important part! Put the following in your flush_opcache.php file:

    <?php opcache_reset(); ?>

    Thread Starter AcidRaZor


    @macmanx As I mentioned, I followed the steps, removed all Themes and only left twentyseventeen. Unless twentyseventeen has a bug in it causing this?

    @swissspidy Thank you for your reply, however, won’t rebooting the server clear OpCache?

    I’ve downgraded to 4.6.1 and things are working again

    Thread Starter AcidRaZor


    @swissspidy I upgraded again, same error, then used the opcache reset trick and it worked

    Thank both of you guys for helping out on this

    @acidrazor Awesome! Great to hear that worked. I’ll note that on the Trac ticket referenced above.

    Regarding your question:

    > won’t rebooting the server clear OpCache?

    This depends on the server setup and what exactly has been restarted, the whole computer, the Apache/nginx web server or the php-fpm service (if applicable). The opcache_reset() variant helps under all circumstances.

    Thread Starter AcidRaZor


    I found the Opcache is an on-going issue, so saw this blog post explaining on how to add a must-use plugin that will clear it before you upgrade:



    Awesome, this worked for me (opcache). Thanks for saving me hours of troubleshooting!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WordPress 4.7 Fatal Error Cannot redeclare get_paged_template()’ is closed to new replies.