Skip to content

Commit 22b8a35

Browse files
Merge pull request #641 from newfold-labs/fix/PRESS10-50
Prevent PHP Deprecated: strip_tags() when the submenu doesn't have a parent
2 parents 80ca909 + 0d49b44 commit 22b8a35

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

includes/WP_Admin.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class WP_Admin {
3030
public function __construct() {
3131
\add_action( 'init', array( __CLASS__, 'load_php_textdomain' ) );
3232
\add_action( 'admin_menu', array( __CLASS__, 'register_page' ) );
33-
\add_filter( 'admin_title', array( __CLASS__, 'page_title' ), 10, 1 );
33+
\add_action( 'load-dashboard_page_' . self::$slug, array( __CLASS__, 'page_title' ), 9, 1 );
3434
\add_action( 'load-dashboard_page_' . self::$slug, array( __CLASS__, 'initialize' ) );
3535
if ( 'sitegen' === Data::current_flow() ) {
3636
\add_action( 'load-themes.php', array( __CLASS__, 'mark_sitegen_generated_themes' ) );
@@ -74,15 +74,13 @@ public static function register_page() {
7474
/**
7575
* Set the page title for the Onboarding page.
7676
*
77-
* @param string $admin_title The title of the admin page.
78-
* @return string
79-
*/
80-
public static function page_title( $admin_title ) {
77+
* @return void
78+
* */
79+
public static function page_title() {
8180
if ( isset( $_GET['page'] ) && \sanitize_text_field( wp_unslash( $_GET['page'] ) ) === self::$slug ) {
82-
$admin_title = \__( 'Onboarding', 'wp-module-onboarding' ) . $admin_title;
81+
global $title;
82+
$title = \__( 'Onboarding', 'wp-module-onboarding' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
8383
}
84-
85-
return $admin_title;
8684
}
8785

8886
/**

0 commit comments

Comments
 (0)