WP_Customize_Nav_Menu_Setting::filter_nav_menu_options() WordPress Method

The WP_Customize_Nav_Menu_Setting::filter_nav_menu_options() Wordpress method is used to filter the nav menu options before they are passed to the customizer. This is useful for adding or removing options based on the current user or theme.

WP_Customize_Nav_Menu_Setting::filter_nav_menu_options( array $nav_menu_options ) #

Filters the nav_menu_options option to include this menu’s auto_add preference.


Parameters

$nav_menu_options

(array)(Required)Nav menu options including auto_add.


Top ↑

Return

(array) (Maybe) modified nav menu options.


Top ↑

Source

File: wp-includes/customize/class-wp-customize-nav-menu-setting.php

	public function filter_nav_menu_options( $nav_menu_options ) {
		if ( get_current_blog_id() !== $this->_previewed_blog_id ) {
			return $nav_menu_options;
		}

		$menu             = $this->value();
		$nav_menu_options = $this->filter_nav_menu_options_value(
			$nav_menu_options,
			$this->term_id,
			false === $menu ? false : $menu['auto_add']
		);

		return $nav_menu_options;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.