PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-import/src/endpoints/class-post.php +10 -5 13.7.2 → 16.3-beta View file →
@@ -11,8 +11,12 @@
11 11 use WP_Error;
12 12 use WP_REST_Request;
13 13 use WP_REST_Response;
14 14
15 +if ( ! defined( 'ABSPATH' ) ) {
16 + exit( 0 );
17 +}
18 +
15 19 if ( ! function_exists( 'post_exists' ) ) {
16 20 require_once ABSPATH . 'wp-admin/includes/post.php';
17 21 }
18 22
@@ -73,8 +77,11 @@
73 77 * @param WP_REST_Request $request Full details about the request.
74 78 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
75 79 */
76 80 public function create_item( $request ) {
81 + // Set the WP_IMPORTING constant to prevent sync notifications
82 + $this->set_importing();
83 +
77 84 // Skip if the post already exists.
78 85 $post_id = \post_exists(
79 86 $request['title'],
80 87 '',
@@ -223,18 +230,16 @@
223 230 * @param array $metas An array of metas to filter.
224 231 * @return array The filtered array of meta keys.
225 232 */
226 233 private function filter_post_meta_keys( $metas ) {
227 - // Define an array of keys to exclude from the filtered array
228 - $excluded_keys = array();
229 234 // Convert array of keys to a plain array of key strings
230 - $meta_keys = array_unique( array_values( array_keys( $metas ) ) );
235 + $meta_keys = array_unique( array_keys( $metas ) );
231 236 // // Filter the array by removing the excluded keys and any keys that include '_oembed'
232 237 $filtered_keys = array_filter(
233 238 $meta_keys,
234 - function ( $key ) use ( $excluded_keys ) {
239 + function ( $key ) {
235 240 // We also don't want to include any oembed post meta because it gets created after a post created
236 - return ! in_array( $key, $excluded_keys, true ) && ! str_contains( $key, '_oembed' );
241 + return ! str_contains( $key, '_oembed' );
237 242 }
238 243 );
239 244 // Return the filtered array
240 245 return $filtered_keys;