Skip to content

Commit

Permalink
Prevent PHP Deprecated: strip_tags() when the submenu doesn't have a …
Browse files Browse the repository at this point in the history
…parent #638
  • Loading branch information
crodriguezbrito committed Dec 19, 2024
1 parent 80ca909 commit 0d49b44
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions includes/WP_Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class WP_Admin {
public function __construct() {
\add_action( 'init', array( __CLASS__, 'load_php_textdomain' ) );
\add_action( 'admin_menu', array( __CLASS__, 'register_page' ) );
\add_filter( 'admin_title', array( __CLASS__, 'page_title' ), 10, 1 );
\add_action( 'load-dashboard_page_' . self::$slug, array( __CLASS__, 'page_title' ), 9, 1 );
\add_action( 'load-dashboard_page_' . self::$slug, array( __CLASS__, 'initialize' ) );
if ( 'sitegen' === Data::current_flow() ) {
\add_action( 'load-themes.php', array( __CLASS__, 'mark_sitegen_generated_themes' ) );
Expand Down Expand Up @@ -74,15 +74,13 @@ public static function register_page() {
/**
* Set the page title for the Onboarding page.
*
* @param string $admin_title The title of the admin page.
* @return string
*/
public static function page_title( $admin_title ) {
* @return void
* */
public static function page_title() {
if ( isset( $_GET['page'] ) && \sanitize_text_field( wp_unslash( $_GET['page'] ) ) === self::$slug ) {
$admin_title = \__( 'Onboarding', 'wp-module-onboarding' ) . $admin_title;
global $title;
$title = \__( 'Onboarding', 'wp-module-onboarding' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
}

return $admin_title;
}

/**
Expand Down

0 comments on commit 0d49b44

Please sign in to comment.