diff --git a/AdminPage.php b/AdminPage.php index 7eb4c3b..f4fb7f2 100644 --- a/AdminPage.php +++ b/AdminPage.php @@ -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; @@ -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. *