[wp-trac] [WordPress Trac] #61615: Toolbar: consider moving user menu to a higher priority (after most plugins)

WordPress Trac noreply at wordpress.org
Wed Jul 24 09:33:02 UTC 2024


#61615: Toolbar: consider moving user menu to a higher priority (after most
plugins)
-------------------------------------------------+-------------------------
 Reporter:  sabernhardt                          |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.6.1
Component:  Toolbar                              |     Version:  6.6
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch dev-reviewed commit        |     Focuses:
  fixed-major                                    |
-------------------------------------------------+-------------------------

Comment (by rabmalin):

 I have this in my theme:


 {{{
 function theme_slug_replace_howdy( $wp_admin_bar ) {
         $my_account = $wp_admin_bar->get_node( 'my-account' );
         $wp_admin_bar->add_node(
                 array(
                         'id'    => 'my-account',
                         'title' => str_replace( 'Howdy,', 'Hello,',
 $my_account->title ),
                 )
         );
 }

 add_action( 'admin_bar_menu', 'theme_slug_replace_howdy', 25 );
 }}}

 After 6.6.1 release I am getting following PHP warnings.
 {{{
 PHP Warning:  Attempt to read property "title" on null in
 /Users/nilambarsharma/Sites/staging/app/public/wp-
 content/themes/khai/functions.php on line 45
 PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of
 type array|string is deprecated in
 /Users/nilambarsharma/Sites/staging/app/public/wp-
 content/themes/khai/functions.php on line 45
 }}}

 I noticed priority of this hook has been changed in the above commit. PHP
 notice is fixed when I keep priority `9999` for my custom hook in my
 theme. Just reporting here because I am not sure whether this issue should
 be fixed in core or in my theme.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61615#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list