Skip to content

Commit 7221eb1

Browse files
committed
Revert [59177].
This was the wrong version of the patch. Unprops @joedolson. git-svn-id: https://develop.svn.wordpress.org/trunk@59178 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4231110 commit 7221eb1

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

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

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public function end_lvl( &$output, $depth = 0, $args = null ) {
126126
* @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added.
127127
* @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id`
128128
* to match parent class for PHP 8 named parameter support.
129-
* @since 6.7.0 Removed redundant title attributes.
130129
*
131130
* @see Walker::start_el()
132131
*
@@ -213,22 +212,8 @@ public function start_el( &$output, $data_object, $depth = 0, $args = null, $cur
213212

214213
$output .= $indent . '<li' . $li_attributes . '>';
215214

216-
/** This filter is documented in wp-includes/post-template.php */
217-
$title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID );
218-
219-
/**
220-
* Filters a menu item's title.
221-
*
222-
* @since 4.4.0
223-
*
224-
* @param string $title The menu item's title.
225-
* @param WP_Post $menu_item The current menu item object.
226-
* @param stdClass $args An object of wp_nav_menu() arguments.
227-
* @param int $depth Depth of menu item. Used for padding.
228-
*/
229-
$title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth );
230-
231215
$atts = array();
216+
$atts['title'] = ! empty( $menu_item->attr_title ) ? $menu_item->attr_title : '';
232217
$atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : '';
233218
$atts['rel'] = ! empty( $menu_item->xfn ) ? $menu_item->xfn : '';
234219

@@ -244,14 +229,6 @@ public function start_el( &$output, $data_object, $depth = 0, $args = null, $cur
244229

245230
$atts['aria-current'] = $menu_item->current ? 'page' : '';
246231

247-
if ( ! empty( $menu_item->attr_title )
248-
&& trim( strtolower( $menu_item->attr_title ) ) !== trim( strtolower( $title ) )
249-
) {
250-
$atts['title'] = $menu_item->attr_title;
251-
} else {
252-
$atts['title'] = '';
253-
}
254-
255232
/**
256233
* Filters the HTML attributes applied to a menu item's anchor element.
257234
*
@@ -274,6 +251,21 @@ public function start_el( &$output, $data_object, $depth = 0, $args = null, $cur
274251
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth );
275252
$attributes = $this->build_atts( $atts );
276253

254+
/** This filter is documented in wp-includes/post-template.php */
255+
$title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID );
256+
257+
/**
258+
* Filters a menu item's title.
259+
*
260+
* @since 4.4.0
261+
*
262+
* @param string $title The menu item's title.
263+
* @param WP_Post $menu_item The current menu item object.
264+
* @param stdClass $args An object of wp_nav_menu() arguments.
265+
* @param int $depth Depth of menu item. Used for padding.
266+
*/
267+
$title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth );
268+
277269
$item_output = $args->before;
278270
$item_output .= '<a' . $attributes . '>';
279271
$item_output .= $args->link_before . $title . $args->link_after;

0 commit comments

Comments
 (0)