← All changes
|
jetpack_vendor/automattic/jetpack-import/src/endpoints/class-page.php
+11
-0
12.2.3
→
16.3
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 Page |
| 12 | 20 | */ |
| 13 | 21 | class Page extends Post { |
| @@ -25,8 +33,11 @@ | ||
| 25 | 33 | * @param WP_REST_Request $request Full details about the request. |
| 26 | 34 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 27 | 35 | */ |
| 28 | 36 | public function create_item( $request ) { |
| 37 | + // Set the WP_IMPORTING constant to prevent sync notifications | |
| 38 | + $this->set_importing(); | |
| 39 | + | |
| 29 | 40 | if ( ! empty( $request['parent'] ) ) { |
| 30 | 41 | $pages = \get_pages( $this->get_import_db_query( $request['parent'] ) ); |
| 31 | 42 | |
| 32 | 43 | // Overwrite the page parent page ID. |