0

Yesterday I tried installing the Thematic theme, which seems very versatile and elegant. Yet I got errors on every page request, even for admin users.

One such error looks like this:

Notice: The called constructor method for WP_Widget in Thematic_Widget_Search is deprecated since version 4.3.0! Use __construct() instead. in /home/iecapxbq/public_html/wp-includes/functions.php on line 3900

Yet line 3900 in functions.php is a catch-all for failed constructors. All 3 failed constructors are for WP_Widget in Thematic_Widget_*. Yet I also get sometimes get 2 more detailed error messages. The first:

headers already sent by (output started at /home/iecapxbq/public_html/wp-includes/functions.php:3900) in /home/iecapxbq/public_html/wp-admin/includes/misc.php on line 1114

On misc.php line 1114, I find the following code:

header( sprintf( 'Referrer-Policy: %s', $policy ) );

This doesn't look like a constructor, especially without a RHS when calling it. Visual Studio 2017. The second:

Warning: Cannot modify header information - headers already sent by (output started at /home/iecapxbq/public_html/wp-includes/functions.php:3900) in /home/iecapxbq/public_html/wp-includes/pluggable.php on line 1216

In pluggable.php line 1216:

header("Location: $location", true, $status);

The same code as the other detailed error. Then I suspect the header() function somehow, but this is still after deleting the whole Thematic folder.

If the fault is with header() then can I make a child-theme that overrides the faulty header()?

I'm using PHP 7 and WP 4.9.

1

The widget errors are the only 'real' errors. The header related errors are just caused by the error notices being output before the HTTP headers (including the one output in misc). Fixing that error would solve the others.

The problem with the widgets is that they are written with out of date PHP (it doesn't appear to have been updated in over 4 years). You can read more about that here: http://php.net/manual/en/migration70.deprecated.php

Un-registering the widgets is probably the simplest solution. You can do that in a child theme with the unregister_widget() function:

unregister_widget( 'Thematic_Widget_Search' );

If you need those specific widgets, then you'll need to unregister them, then re-register them with your own code for them that doesn't have the constructor issue.

Ultimately though the issue is that the theme isn't PHP7 compatible, and isn't maintained any longer. You'll probably want to find a different theme.

  • Hehe, Call to undefined function unregister_widget() . Maybe I should just re-install WP: the db is still fine and I haven't made any code changes only new themes – ProfK Nov 19 '17 at 9:24
  • Make sure you’re using it in widgets_init hook, to makes sure it’s defined. Reinstalling WordPress won’t help that or your original issues. – Jacob Peattie Nov 19 '17 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.