WPCOM_JSON_API_Menus_New_Menu_Endpoint

The Jetpack by WordPress.com WPCOM JSON API Menus New Menu Endpoint class.

Defined (1)

The class is defined in the following location(s).

/json-endpoints/class.wpcom-json-api-menus-v1-1-endpoint.php  
  1. class WPCOM_JSON_API_Menus_New_Menu_Endpoint extends WPCOM_JSON_API_Menus_Abstract_Endpoint { 
  2. function callback( $path = '', $site = 0 ) { 
  3. $site_id = $this->switch_to_blog_and_validate_user( $this->api->get_blog_id( $site ) ); 
  4.  
  5. if ( is_wp_error( $site_id ) ) { 
  6. return $site_id; 
  7.  
  8. $data = $this->input(); 
  9.  
  10. $id = wp_create_nav_menu( $data['name'] ); 
  11.  
  12. if ( is_wp_error( $id ) ) { 
  13. return $id; 
  14.  
  15. return array( 'id' => $id );