← All changes
|
jetpack_vendor/automattic/jetpack-import/src/endpoints/class-menu.php
+11
-0
12.3.2
→
16.3-beta
View file →
| @@ -6,8 +6,16 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Automattic\Jetpack\Import\Endpoints; |
| 9 | 9 | |
| 10 | +use WP_Error; | |
| 11 | +use WP_REST_Request; | |
| 12 | +use WP_REST_Response; | |
| 13 | + | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit( 0 ); | |
| 16 | +} | |
| 17 | + | |
| 10 | 18 | /** |
| 11 | 19 | * Class Menu |
| 12 | 20 | */ |
| 13 | 21 | class Menu extends \WP_REST_Menus_Controller { |
| @@ -45,8 +53,11 @@ | ||
| 45 | 53 | * @param WP_REST_Request $request Full details about the request. |
| 46 | 54 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 47 | 55 | */ |
| 48 | 56 | public function create_item( $request ) { |
| 57 | + // Set the WP_IMPORTING constant to prevent sync notifications | |
| 58 | + $this->set_importing(); | |
| 59 | + | |
| 49 | 60 | $response = parent::create_item( $request ); |
| 50 | 61 | |
| 51 | 62 | // Ensure that the HTTP status is a valid one. |
| 52 | 63 | $response = $this->ensure_http_status( $response, 'menu_exists', 409 ); |