WPCOM_JSON_API_Menus_Delete_Menu_Endpoint

The Jetpack by WordPress.com WPCOM JSON API Menus Delete 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_Delete_Menu_Endpoint extends WPCOM_JSON_API_Menus_Abstract_Endpoint { 
  2. function callback( $path = '', $site = 0, $menu_id = 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. if ( $menu_id <= 0 ) { 
  9. return new WP_Error( 'menu-id', 'Menu ID must be greater than 0.', 400 ); 
  10.  
  11. $result = wp_delete_nav_menu( $menu_id ); 
  12. if ( ! is_wp_error( $result ) ) { 
  13. $result = array( 'deleted' => $result ); 
  14.  
  15. return $result;