unFocus / Scripts-n-Styles

Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.

Home Page:http://www.unFocus.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

contextual_help is deprecated

jonathanstanley opened this issue · comments

warning on recent WordPress

Deprecated: contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead. in /public/wp/wp-includes/functions.php on line 5088

looks like another report here https://wordpress.org/support/topic/wp-5-4-deprecated-contextual_help/

i have sns v 3.5.1, but releases here on github only go to 3.3.1 and the files look substantially different. closest I can link to where the issue may originate: https://github.com/unFocus/Scripts-n-Styles/blob/master/dist/includes/meta-box.php#L244

fwiw, the fix on 3.5.1 is in /includes/class-sns-meta-box.php add_meta_boxes()...

 				add_filter( 'default_hidden_meta_boxes', array( __CLASS__,  'default_hidden_meta_boxes' )  );
 				add_action( "admin_print_styles", array( __CLASS__, 'meta_box_styles'));
 				add_action( "admin_print_scripts", array( __CLASS__, 'meta_box_scripts'));
-				add_filter( 'contextual_help', array( 'SnS_Admin', 'help' ) );
+				if (!method_exists(get_current_screen(), 'add_help_tab')) {
+                    add_filter('contextual_help', array( 'SnS_Admin', 'help' ));
+                }
 				add_filter( 'mce_buttons_2', array( __CLASS__, 'mce_buttons_2' ) );
 				add_filter( 'tiny_mce_before_init', array( __CLASS__, 'tiny_mce_before_init' ) );
 				add_filter( 'replace_editor', array( __CLASS__, 'mce_css' ) );

here is a link to an older version of the file that appears to match:
https://github.com/unFocus/Scripts-n-Styles/blob/3.3.1/includes/class-sns-meta-box.php#L89-L103