WP_REST_Menus_Controller::get_menu_auto_add()protectedWP 5.9.0

Returns the value of a menu's auto_add setting.

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

No Hooks.

Return

true|false. The value of auto_add.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_menu_auto_add( $menu_id );
$menu_id(int) (required)
The menu id to query.

Changelog

Since 5.9.0 Introduced.

Code of WP_REST_Menus_Controller::get_menu_auto_add() WP 6.0

protected function get_menu_auto_add( $menu_id ) {
	$nav_menu_option = (array) get_option( 'nav_menu_options', array( 'auto_add' => array() ) );

	return in_array( $menu_id, $nav_menu_option['auto_add'], true );
}