My WP Trek

Playing with WordPress

create_function is deprecated

code php wordpress

Php function ‘create_function‘ has been deprecated as of PHP 7.2.0.

So, while initializing widget I used to do this,

add_action( 'widgets_init', create_function( '', 'register_widget("Widget_Name");' ) );

Now, replacing deprecated function,

    function() {
        register_widget( 'Widget_Name' );


create_function is deprecated

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top