Categories
WordPress Development

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 …/wp-includes/functions.php on line 5152

There can be several plugins related to the issue, but it can be also SendGrid plugin. The fix this problem modify sendgrid-email-delivery-simplified/lib/class-sendgrid-settings.php in line 52 – replace:

add_filter( ‘contextual_help’, array( __CLASS__, ‘show_contextual_help’ ), 10, 3 );

with:

add_filter( ‘current_screen’, array( __CLASS__, ‘show_contextual_help’ ), 10 );

And replace public function in line 101

public static function show_contextual_help( $contextual_help, $screen_id, $screen )

with this version:

public static function show_contextual_help()
{
    $screen = get_current_screen();

    if ( SENDGRID_PLUGIN_STATISTICS == $screen->id or SENDGRID_PLUGIN_SETTINGS == $screen->id ) {

        $screen->add_help_tab(
            array(
                'id'      => 'sendgrid_help_tab',
                'title'   => __( 'Help' ),
                'content' => file_get_contents( dirname( __FILE__ ) . '/../view/sendgrid_contextual_help.php' )
            )
        );

    }

}

The fix was found here: Plugin Uses Depricated function.