[wp-trac] [WordPress Trac] #46382: [walker-nav-menu] Undefined property stdclass::$current in class-walker-nav-menu.php

WordPress Trac noreply at wordpress.org
Wed Jun 14 15:34:06 UTC 2023


#46382: [walker-nav-menu] Undefined property stdclass::$current in class-walker-
nav-menu.php
--------------------------+------------------------------
 Reporter:  winston_wolf  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  5.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by KTS915):

 Looks like lines 180 to 196 inclusive should be changed to read as
 follows:

 {{{
 if ( ! empty( $menu_item->target ) && '_blank' === $menu_item->target &&
 empty( $menu_item->xfn ) ) {
                         $atts['rel'] = 'noopener';
                 } else {
                         $atts['rel'] = ! empty( $menu_item->xfn ) ?
 $menu_item->xfn : '';
                 }

                 if ( ! empty( $menu_item->url ) ) {
                         if ( get_privacy_policy_url() === $menu_item->url
 ) {
                                 $atts['rel'] = empty( $atts['rel'] ) ?
 'privacy-policy' : $atts['rel'] . ' privacy-policy';
                         }

                         $atts['href'] = $menu_item->url;
                 } else {
                         $atts['href'] = '';
                 }

                 $atts['aria-current'] = ! empty( $menu_item->current ) ?
 'page' : '';
 }}}

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


More information about the wp-trac mailing list