WP_REST_Menus_Controller::get_menu_auto_add()
Returns the value of a menu's auto_add setting.
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. |
WP_REST_Menus_Controller::get_menu_auto_add() WP REST Menus Controller::get menu auto add code WP 6.6.1
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 ); }