wppaste
WordPress

apply_filters( 'walker_nav_menu_start_el', string $item_output, WP_Post $menu_item, int $depth, stdClass $args )

Since
3.0.0
Filters a menu item's starting output.

Description

The menu item's starting output only includes $args->before, the opening <a>, the menu item's title, the closing </a>, and $args->after. Currently, there is no filter for modifying the opening and closing <li> for a menu item.

Compatibility

WordPress
since 3.0.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$item_outputstring
The menu item's starting HTML output.
$menu_itemWP_Post
Menu item data object.
$depthint
Depth of menu item. Used for padding.
$argsstdClass
An object of wp_nav_menu() arguments.

Where this hook fires · 1

  • wp-includes/class-walker-nav-menu.php:320Walker_Nav_Menu::start_el()

Source code

<?php		 *		 * @param string   $item_output The menu item's starting HTML output.		 * @param WP_Post  $menu_item   Menu item data object.		 * @param int      $depth       Depth of menu item. Used for padding.		 * @param stdClass $args        An object of wp_nav_menu() arguments.		 */		$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $menu_item, $depth, $args );	} 	/**	 * Ends the element output, if needed.	 *	 * @since 3.0.0

Changelog

Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.