My WP Trek

Playing with WordPress

deprecated

create_function is deprecated

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, add_action( ‘widgets_init’, function() { register_widget( ‘Widget_Name’ ); } );  

Scroll to top