• Resolved agkozak

    (@agkozak)


    I keep getting the following warning in my PHP error log:

    PHP Deprecated: Function create_function() is deprecated in /home/elsiecar/public_html/wp-content/plugins/wp-youtube-lyte/widget.php on line 169

    It does appear that create_function() is deprecated in PHP 7.2. The elegant thing to do would, I think, be to use a proper anonymous function, but those aren’t supported before PHP 5.3, and WordPress tries to be backwards compatible to PHP 5.2.4.

    Perhaps you might replace

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

    with

    function lyte_register_widget() {
    register_widget('WYLWidget');
    }

    add_action('widgets_init', 'lyte_register_widget');

    Alex

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘create_function() deprecated in widget.php on line 169’ is closed to new replies.