Ticket #51299: 51299.1.diff
File 51299.1.diff, 2.3 KB (added by , 3 years ago) |
---|
-
src/wp-includes/class-walker-nav-menu.php
106 106 * 107 107 * @since 3.0.0 108 108 * @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added. 109 * @since x.x.x Removed redundant title attributes. 109 110 * 110 111 * @see Walker::start_el() 111 112 * … … 169 170 170 171 $output .= $indent . '<li' . $id . $class_names . '>'; 171 172 173 /** This filter is documented in wp-includes/post-template.php */ 174 $title = apply_filters( 'the_title', $item->title, $item->ID ); 175 176 /** 177 * Filters a menu item's title. 178 * 179 * @since 4.4.0 180 * 181 * @param string $title The menu item's title. 182 * @param WP_Post $item The current menu item. 183 * @param stdClass $args An object of wp_nav_menu() arguments. 184 * @param int $depth Depth of menu item. Used for padding. 185 */ 186 $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth ); 187 172 188 $atts = array(); 173 189 $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; 174 190 $atts['target'] = ! empty( $item->target ) ? $item->target : ''; … … 201 217 */ 202 218 $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); 203 219 220 // Remove redundant title attributes. 221 if ( trim( strtolower( $atts['title'] ) ) == trim( strtolower( $title ) ) ) { 222 $atts['title'] = ''; 223 } 224 204 225 $attributes = ''; 205 226 foreach ( $atts as $attr => $value ) { 206 227 if ( is_scalar( $value ) && '' !== $value && false !== $value ) { … … 209 230 } 210 231 } 211 232 212 /** This filter is documented in wp-includes/post-template.php */213 $title = apply_filters( 'the_title', $item->title, $item->ID );214 215 /**216 * Filters a menu item's title.217 *218 * @since 4.4.0219 *220 * @param string $title The menu item's title.221 * @param WP_Post $item The current menu item.222 * @param stdClass $args An object of wp_nav_menu() arguments.223 * @param int $depth Depth of menu item. Used for padding.224 */225 $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth );226 227 233 $item_output = $args->before; 228 234 $item_output .= '<a' . $attributes . '>'; 229 235 $item_output .= $args->link_before . $title . $args->link_after;