Solution - Method for WP Widget in MY CommentWidget is deprecated since version 4 -Wordpress error

Опубликовано: 11 Март 2026
на канале: Vivek Bhatt
423
4

Recently when I updated the php version for my wordpress site i got a sitewide error line on the site -

method for WP_Widget in MY_CommentWidget is deprecated since version 4.3.0! Use __construct() instead ...

To solve this i added one line of code at the start of functions.php file in the wp/includes folder -

The code is given inside the brackets [ add_filter('deprecated_constructor_trigger_error', '__return_false'); ]

Then I downgraded the version of php to 5.6

This is a temporary solution as I am using an old version of php. So I need to check the theme and plugins code to ensure that they become compatible with the new php version.