Make WordPress Core

Ticket #51299: 51299.2.diff

File 51299.2.diff, 1.3 KB (added by sabernhardt, 22 months ago)
  • src/wp-includes/class-walker-nav-menu.php

     
    106106         *
    107107         * @since 3.0.0
    108108         * @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added.
     109         * @since x.x.x Removed redundant title attributes.
    109110         *
    110111         * @see Walker::start_el()
    111112         *
     
    169170
    170171                $output .= $indent . '<li' . $id . $class_names . '>';
    171172
     173                /** This filter is documented in wp-includes/post-template.php */
     174                $title = apply_filters( 'the_title', $item->title, $item->ID );
     175
    172176                $atts           = array();
    173                 $atts['title']  = ! empty( $item->attr_title ) ? $item->attr_title : '';
     177                $atts['title']  = ( ! empty( $item->attr_title ) && trim( strtolower( $item->attr_title ) ) != trim( strtolower( $title ) ) ) ? $item->attr_title : '';
    174178                $atts['target'] = ! empty( $item->target ) ? $item->target : '';
    175179                if ( '_blank' === $item->target && empty( $item->xfn ) ) {
    176180                        $atts['rel'] = 'noopener';
     
    209213                        }
    210214                }
    211215
    212                 /** This filter is documented in wp-includes/post-template.php */
    213                 $title = apply_filters( 'the_title', $item->title, $item->ID );
    214 
    215216                /**
    216217                 * Filters a menu item's title.
    217218                 *