#StackBounty: #theme-development #upgrade Upgrade from 5.0.4 to 5.1.1 causes $theme to be null

Bounty: 50

When we upgrade from 5.0.4 to 5.1.1 the site stops loading.

The error message is

Fatal error:  Uncaught Error: Call to a member function images_path() on null 
/wp-content/themes/mytheme/header.php on line 49

Line 49 is
<?php $theme->images_path(); ?>

$theme is created in functions.php as the instance of our custom theme.

class MyTheme {
...
}

$theme = new MyTheme();

The full stacktrace is

Stack trace:
/wp-includes/template.php(704): require_once()
/wp-includes/template.php(653): load_template('/nas/content/li...', true)
/wp-includes/general-template.php(41): locate_template(Array, true)
/wp-content/themes/myTheme/page-home.php(7): get_header()
/wp-includes/template-loader.php(77): include('/nas/content/li...')
/wp-blog-header.php(19): require_once('/nas/content/li...')
/index.php(17): require('/nas/content/li...')n#7 {main}

thrown in 
/wp-content/themes/myTheme/header.php on line 49

I don’t know how to troubleshoot this issue. Everything worked great prior to the upgrade and no other changes were made to the site.

Any help appreciated.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.