PHP, WP/CP | Type: PHPReplace Deprecated Init create_function (php 7.2)

Several plugins still use the deprecated function.

EXAMPLE (SSN)
//deprecated version
add_action('widgets_init', create_function('', 'return register_widget("SimpleSectionNav");'));
//7.2 ready version
function ssn_register_widget() { return register_widget("SimpleSectionNav"); }
add_action( 'widgets_init', 'ssn_register_widget' );

EXAMPLE
//deprecated version
add_filter( 'option_page_capability_' . ot_options_id(), create_function( '$caps', "return '$caps';" ), 999 );
replace with
//7.2 ready version
add_filter( 'option_page_capability_' . ot_options_id(), function($caps) {return $caps;},999);

EXAMPLE (OZH MENU)
//deprecated version
add_action('admin_notices', create_function( '', "echo '$message';" ) );
replace with
//7.2 ready version
add_action( 'admin_notices', function() {echo $message;} );

Reference Links

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept