Skip to content

Commit

Permalink
Revert [59177].
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joedolson committed Oct 5, 2024
1 parent 4231110 commit 7221eb1
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions src/wp-includes/class-walker-nav-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public function end_lvl( &$output, $depth = 0, $args = null ) {
* @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added.
* @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id`
* to match parent class for PHP 8 named parameter support.
* @since 6.7.0 Removed redundant title attributes.
*
* @see Walker::start_el()
*
Expand Down Expand Up @@ -213,22 +212,8 @@ public function start_el( &$output, $data_object, $depth = 0, $args = null, $cur

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

/** This filter is documented in wp-includes/post-template.php */
$title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID );

/**
* Filters a menu item's title.
*
* @since 4.4.0
*
* @param string $title The menu item's title.
* @param WP_Post $menu_item The current menu item object.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth );

$atts = array();
$atts['title'] = ! empty( $menu_item->attr_title ) ? $menu_item->attr_title : '';
$atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : '';
$atts['rel'] = ! empty( $menu_item->xfn ) ? $menu_item->xfn : '';

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

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

if ( ! empty( $menu_item->attr_title )
&& trim( strtolower( $menu_item->attr_title ) ) !== trim( strtolower( $title ) )
) {
$atts['title'] = $menu_item->attr_title;
} else {
$atts['title'] = '';
}

/**
* Filters the HTML attributes applied to a menu item's anchor element.
*
Expand All @@ -274,6 +251,21 @@ public function start_el( &$output, $data_object, $depth = 0, $args = null, $cur
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth );
$attributes = $this->build_atts( $atts );

/** This filter is documented in wp-includes/post-template.php */
$title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID );

/**
* Filters a menu item's title.
*
* @since 4.4.0
*
* @param string $title The menu item's title.
* @param WP_Post $menu_item The current menu item object.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth );

$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . $title . $args->link_after;
Expand Down

0 comments on commit 7221eb1

Please sign in to comment.