WordPress at a glance
function is not described

WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menu_object() public WP 4.3.0

Filters the wp_get_nav_menu_object() result to supply the previewed menu object.

Requesting a nav_menu object by anything but ID is not supported.

{} It's a method of the class: WP_Customize_Nav_Menu_Setting{}

No Hooks.

Return

Object|null. Nothing.

Usage

$WP_Customize_Nav_Menu_Setting = new WP_Customize_Nav_Menu_Setting();
$WP_Customize_Nav_Menu_Setting->filter_wp_get_nav_menu_object( $menu_obj, $menu_id );
$menu_obj(object|null) (required)
Object returned by wp_get_nav_menu_object().
$menu_id(string) (required)
ID of the nav_menu term. Requests by slug or name will be ignored.

Notes

  • See: wp_get_nav_menu_object()

Changelog

Since 4.3.0 Introduced.

Code of WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menu_object() WP 5.7.2

<?php
public function filter_wp_get_nav_menu_object( $menu_obj, $menu_id ) {
	$ok = (
		get_current_blog_id() === $this->_previewed_blog_id
		&&
		is_int( $menu_id )
		&&
		$menu_id === $this->term_id
	);
	if ( ! $ok ) {
		return $menu_obj;
	}

	$setting_value = $this->value();

	// Handle deleted menus.
	if ( false === $setting_value ) {
		return false;
	}

	// Handle sanitization failure by preventing short-circuiting.
	if ( null === $setting_value ) {
		return $menu_obj;
	}

	$menu_obj = (object) array_merge(
		array(
			'term_id'          => $this->term_id,
			'term_taxonomy_id' => $this->term_id,
			'slug'             => sanitize_title( $setting_value['name'] ),
			'count'            => 0,
			'term_group'       => 0,
			'taxonomy'         => self::TAXONOMY,
			'filter'           => 'raw',
		),
		$setting_value
	);

	return $menu_obj;
}