Browse Source

fix depr null on str_replace

windhamdavid 4 months ago
parent
commit
42f59826d0
1 changed files with 6 additions and 8 deletions
  1. 6 8
      functions.php

+ 6 - 8
functions.php

@@ -85,15 +85,13 @@ function uhp24_footer_filter ($default) {
   return '';
   return '';
 }
 }
 
 
-add_filter( 'admin_bar_menu', 'uhp24_replace_wordpress_howdy', 25 );
-function uhp24_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', 'uhp24_change_howdy', 10, 3);
+function uhp24_change_howdy($translated, $text, $domain) {
+    if (false !== strpos($translated, 'Howdy,'))
+        return str_replace('Howdy,', '', $translated);
+    return $translated;
 }
 }
+
 /* for email */
 /* for email */
 add_filter( 'gettext', 'uhp24_change_howdy_text', 10, 2 );
 add_filter( 'gettext', 'uhp24_change_howdy_text', 10, 2 );
 function uhp24_change_howdy_text( $translation, $original ) {
 function uhp24_change_howdy_text( $translation, $original ) {