Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for PHP notice caused by deprecated hook 'contextual_help' #54

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion AdminPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function __construct( $file = false, $options = null ) {
}

add_action( 'admin_menu', array( $this, 'page_init' ), $this->args['admin_action_priority'] );
add_filter( 'contextual_help', array( $this, '_contextual_help' ), 10, 2 );
add_action( 'current_screen', array( $this, '_contextual_help_compat' ) );

if ( $file ) {
$this->file = $file;
Expand Down Expand Up @@ -553,6 +553,20 @@ public function _contextual_help( $help, $screen ) {
return $help;
}

/**
* Sets the old string-based contextual help for the screen for backward compatibility.
*
* @param WP_Screen $screen
*/
public function _contextual_help_compat( $screen ) {

$actual_help = $this->_contextual_help( '', $screen );

if ( $screen->id == $this->pagehook && $actual_help ) {
$screen::add_old_compat_help( $screen, $actual_help );
}
}

/**
* Displays page content.
*
Expand Down