Though I've seen references to similar errors, I have yet to find one quite like my own very special error here.
SAD STORY
A parent theme produces a number of proprietary widgets. Unfortunately, these widgets are not modifiable via filter hook, so, unless I want to just hack them to make them take a tag from a certain plug-in modifying a bit of html output, they need to be re-produced via the child theme. Or anyway that was the route I took.
It seemed to be a straightforward operation: Create a new file for the new widgets, and register the new Child Widgets under new names, with the required alterations in the individual widget classes encoded in the same file (as in the parent theme). The new child widgets are all identical to the original theme's widgets, except that "child_" is added to their class statements, and the code to modify their output is added where needed.
Nothing else is changed, and, like I said, the result works fine on my development site running PHP 5.6.30/WP 4.73, but, on two remote sites, both running WP 4.73, one on 5.6.30 the other PHP 7.x, I get variations on the following crash error:
[08-Mar-2017 16:27:53 UTC] PHP Fatal error: Uncaught Error: Call to a member function add_help_tab() on null in /web/htdocs3/pokeventurepl/home/www/wp-admin/widgets.php:51
Stack trace:
#0 /web/htdocs3/pokeventurepl/home/www/wp-content/themes/colormag-pro-child/functions.php(97): include_once()
#1 /web/htdocs3/pokeventurepl/home/www/wp-settings.php(423): include('/web/htdocs3/po...')
#2 /web/htdocs3/pokeventurepl/home/www/wp-config.php(80): require_once('/web/htdocs3/po...')
#3 /web/htdocs3/pokeventurepl/home/www/wp-load.php(37): require_once('/web/htdocs3/po...')
#4 /web/htdocs3/pokeventurepl/home/www/wp-admin/admin.php(31): require_once('/web/htdocs3/po...')
#5 /web/htdocs3/pokeventurepl/home/www/wp-admin/themes.php(10): require_once('/web/htdocs3/po...')
#6 {main}
thrown in /web/htdocs3/pokeventurepl/home/www/wp-admin/widgets.php on line 51
The line from wp-admin/widgets.php is this one:
get_current_screen()->add_help_tab( array(
If I disable the child widgets (commenting out include_once( 'child_widgets.php' ) ;
from the child theme functions.php file) there's no crash, except, of course, there aren't any child widgets to use.
The crash occurs even when there are no plugins activated. It also occurs when I disable all widgets in the parent theme.
MY PLEA
Any ideas?