@@ -30,6 +30,7 @@ final class WP_Admin {
30
30
public function __construct () {
31
31
\add_action ( 'init ' , array ( __CLASS__ , 'load_php_textdomain ' ) );
32
32
\add_action ( 'admin_menu ' , array ( __CLASS__ , 'register_page ' ) );
33
+ \add_filter ( 'admin_title ' , array ( __CLASS__ , 'page_title ' ), 10 , 1 );
33
34
\add_action ( 'load-dashboard_page_ ' . self ::$ slug , array ( __CLASS__ , 'initialize ' ) );
34
35
if ( 'sitegen ' === Data::current_flow () ) {
35
36
\add_action ( 'load-themes.php ' , array ( __CLASS__ , 'mark_sitegen_generated_themes ' ) );
@@ -70,6 +71,20 @@ public static function register_page() {
70
71
);
71
72
}
72
73
74
+ /**
75
+ * Set the page title for the Onboarding page.
76
+ *
77
+ * @param string $admin_title The title of the admin page.
78
+ * @return string
79
+ */
80
+ public static function page_title ( $ admin_title ) {
81
+ if ( isset ( $ _GET ['page ' ] ) && \sanitize_text_field ( wp_unslash ( $ _GET ['page ' ] ) ) === self ::$ slug ) {
82
+ $ admin_title = \__ ( 'Onboarding ' , 'wp-module-onboarding ' ) . $ admin_title ;
83
+ }
84
+
85
+ return $ admin_title ;
86
+ }
87
+
73
88
/**
74
89
* Render DOM element for React SPA mount.
75
90
*
@@ -155,12 +170,6 @@ public static function enqueue_block_assets() {
155
170
* @return void
156
171
*/
157
172
public static function initialize () {
158
- global $ title ;
159
-
160
- if ( is_null ( $ title ) ) {
161
- $ title = __ ( 'Onboarding ' , 'wp-module-onboarding ' );
162
- }
163
-
164
173
if ( ! empty ( $ _GET ['nfd_plugins ' ] ) && 'true ' === sanitize_text_field ( $ _GET ['nfd_plugins ' ] ) ) {
165
174
PluginService::initialize ();
166
175
}
0 commit comments