WP_REST_Menus_Controller::get_menu_auto_add() WordPress Method
The WP_REST_Menus_Controller::get_menu_auto_add() method is used to get the list of menu items that should be automatically added to a menu. This is useful for creating menus from scratch or for adding new content to an existing menu.
WP_REST_Menus_Controller::get_menu_auto_add( int $menu_id ) #
Returns the value of a menu’s auto_add setting.
Parameters
- $menu_id
(int)(Required)The menu id to query.
Return
(bool) The value of auto_add.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
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 ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |