WordPress at a glance
function is not described

WP_Customize_Nav_Menu_Setting::filter_nav_menu_options_value() protected WP 4.3.0

Updates a nav_menu_options array.

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

No Hooks.

Return

Array. (Maybe) modified nav_menu_otions array.

Usage

// protected - for code of main (parent) or child class
$result = $this->filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add );
$nav_menu_options(array) (required)
Array as returned by get_option( 'nav_menu_options' ).
$menu_id(int) (required)
The term ID for the given menu.
$auto_add(true|false) (required)
Whether to auto-add or not.

Notes

  • See: WP_Customize_Nav_Menu_Setting::filter_nav_menu_options()
  • See: WP_Customize_Nav_Menu_Setting::update()

Changelog

Since 4.3.0 Introduced.

Code of WP_Customize_Nav_Menu_Setting::filter_nav_menu_options_value() WP 5.7.2

<?php
protected function filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add ) {
	$nav_menu_options = (array) $nav_menu_options;
	if ( ! isset( $nav_menu_options['auto_add'] ) ) {
		$nav_menu_options['auto_add'] = array();
	}

	$i = array_search( $menu_id, $nav_menu_options['auto_add'], true );

	if ( $auto_add && false === $i ) {
		array_push( $nav_menu_options['auto_add'], $this->term_id );
	} elseif ( ! $auto_add && false !== $i ) {
		array_splice( $nav_menu_options['auto_add'], $i, 1 );
	}

	return $nav_menu_options;
}