Browse Source

fix depr null on str_replace

windhamdavid 5 months ago
parent
commit
182f3b0d9c
1 changed files with 5 additions and 8 deletions
  1. 5 8
      functions.php

+ 5 - 8
functions.php

@@ -233,14 +233,11 @@ function gwp24_remove_adminbar( $wp_admin_bar ) {
   $wp_admin_bar->remove_node( 'view-site' );
 }
 
-add_filter( 'admin_bar_menu', 'gwp24_replace_wordpress_howdy', 25 );
-function gwp24_replace_wordpress_howdy( $wp_admin_bar ) {
-  $account = $wp_admin_bar->get_node('my-account');
-  $newtext = str_replace( 'Howdy,', '', $account->title );
-  $wp_admin_bar->add_node( array(
-    'id' => 'my-account',
-    'title' => $newtext,
-  ));
+add_filter( 'gettext', 'gwp24_change_howdy_text', 10, 2 );
+function gwp24_change_howdy_text( $translation, $original ) {
+  if( 'Howdy, %1$s' == $original )
+    $translation = '%1$s';
+  return $translation;
 }
 /* for email */
 add_filter( 'gettext', 'gwp24_change_howdy_text', 10, 2 );