0

My site is currently on PHP 7.2.0, and I'm getting this error in my debug log showing PHP Deprecated: Function create_function() is deprecated

I don't know what happened but my site somehow became broken and stuff wasn't showing properly. The only way I can access my wordpress dashboard is when I force the site to load on a default theme.

So I guess the problem lies within my Theme...

Right now, the site doesn't load up at all and it's showing a blank white screen or saying that The site is experiencing technical difficulties.

I'm still a new web developer... Any idea what could have gone wrong and how to fix my current code that is showing the error?

add_action('widgets_init', create_function('', 'return register_widget("Essential_Grids_Widget");'));

Thanks for your help!

krysis
  • 1
  • 2
  • 2
    Possible duplicate of [PHP 7.2 Function create\_function() is deprecated](https://stackoverflow.com/questions/48161526/php-7-2-function-create-function-is-deprecated) – Don't Panic Oct 25 '19 at 22:29

1 Answers1

0

use it like this

$MywidgetName='Essential_Grids_Widget';
add_action('widgets_init', function () use ($MywidgetName) {
    return register_widget($MywidgetName);
});