pre_wp_setup_nav_menu_item filter-hookWP 6.3.0

Filters whether to short-circuit the wp_setup_nav_menu_item() output.

Returning a non-null value from the filter will short-circuit wp_setup_nav_menu_item(), returning that value instead.

Usage

add_filter( 'pre_wp_setup_nav_menu_item', 'wp_kama_pre_wp_setup_nav_menu_item_filter', 10, 2 );

/**
 * Function for `pre_wp_setup_nav_menu_item` filter-hook.
 * 
 * @param object|null $modified_menu_item Modified menu item.
 * @param object      $menu_item          The menu item to modify.
 *
 * @return object|null
 */
function wp_kama_pre_wp_setup_nav_menu_item_filter( $modified_menu_item, $menu_item ){

	// filter...
	return $modified_menu_item;
}
$modified_menu_item(object|null)
Modified menu item.
Default: null
$menu_item(object)
The menu item to modify.

Changelog

Since 6.3.0 Introduced.

Where the hook is called

wp_setup_nav_menu_item()
pre_wp_setup_nav_menu_item
wp-includes/nav-menu.php 840
$pre_menu_item = apply_filters( 'pre_wp_setup_nav_menu_item', null, $menu_item );

Where the hook is used in WordPress

Usage not found.