Make WordPress Core

Ticket #51299: 51299.diff

File 51299.diff, 2.2 KB (added by audrasjb, 3 years ago)

Title attribute not displayed anymore but keep the variable for backward compatibility

  • src/wp-includes/class-walker-nav-menu.php

    diff --git a/src/wp-includes/class-walker-nav-menu.php b/src/wp-includes/class-walker-nav-menu.php
    index 5f4a53691c..519e690d56 100644
    a b class Walker_Nav_Menu extends Walker { 
    170170                $output .= $indent . '<li' . $id . $class_names . '>';
    171171
    172172                $atts           = array();
    173                 $atts['title']  = ! empty( $item->attr_title ) ? $item->attr_title : '';
     173                $atts['title']  = '';
    174174                $atts['target'] = ! empty( $item->target ) ? $item->target : '';
    175175                if ( '_blank' === $item->target && empty( $item->xfn ) ) {
    176176                        $atts['rel'] = 'noopener noreferrer';
    class Walker_Nav_Menu extends Walker { 
    185185                 *
    186186                 * @since 3.6.0
    187187                 * @since 4.1.0 The `$depth` parameter was added.
     188                 * @since 5.6.0 The `title` attribute is not printed anymore.
    188189                 *
    189190                 * @param array $atts {
    190191                 *     The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
    191192                 *
    192                  *     @type string $title        Title attribute.
    193193                 *     @type string $target       Target attribute.
    194194                 *     @type string $rel          The rel attribute.
    195195                 *     @type string $href         The href attribute.
    class Walker_Nav_Menu extends Walker { 
    209209                        }
    210210                }
    211211
    212                 /** This filter is documented in wp-includes/post-template.php */
    213                 $title = apply_filters( 'the_title', $item->title, $item->ID );
     212                // The title attribute is not used anymore.
     213                $title = '';
    214214
    215215                /**
    216216                 * Filters a menu item's title.
    217217                 *
    218218                 * @since 4.4.0
     219                 * @since 5.6.0 The `title` attribute was removed.
    219220                 *
    220                  * @param string   $title The menu item's title.
     221                 * @param string   $title The menu item's title. Not displayed anymore.
    221222                 * @param WP_Post  $item  The current menu item.
    222223                 * @param stdClass $args  An object of wp_nav_menu() arguments.
    223224                 * @param int      $depth Depth of menu item. Used for padding.
    class Walker_Nav_Menu extends Walker { 
    226227
    227228                $item_output  = $args->before;
    228229                $item_output .= '<a' . $attributes . '>';
    229                 $item_output .= $args->link_before . $title . $args->link_after;
     230                $item_output .= $args->link_before . $args->link_after;
    230231                $item_output .= '</a>';
    231232                $item_output .= $args->after;
    232233