Updates a nav_menu_options array.
Description
See also
Parameters
$nav_menu_options
arrayrequired- Array as returned by get_option(
'nav_menu_options'
). $menu_id
intrequired- The term ID for the given menu.
$auto_add
boolrequired- Whether to auto-add or not.
Source
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;
}
Changelog
Version | Description |
---|---|
4.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.