← All changes
|
jetpack_vendor/automattic/jetpack-import/src/endpoints/class-template.php
+11
-0
13.0.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 Template |
| 12 | 20 | */ |
| 13 | 21 | class Template extends \WP_REST_Templates_Controller { |
| @@ -42,8 +50,11 @@ | ||
| 42 | 50 | * @param WP_REST_Request $request Full details about the request. |
| 43 | 51 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 44 | 52 | */ |
| 45 | 53 | public function create_item( $request ) { |
| 54 | + // Set the WP_IMPORTING constant to prevent sync notifications | |
| 55 | + $this->set_importing(); | |
| 56 | + | |
| 46 | 57 | $response = parent::create_item( $request ); |
| 47 | 58 | |
| 48 | 59 | return $this->add_import_id_metadata( $request, $response ); |
| 49 | 60 | } |