PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.4
Elementor Website Builder – more than just a page builder v4.2.4
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | modules/wp-rest/classes/post-query.php +12 -7 4.2.0-dev24.2.4 View file →
@@ -67,16 +67,21 @@
67 67 $is_public_only = $params[ self::IS_PUBLIC_KEY ] ?? true;
68 68 $post_types = $this->get_post_types_from_params( $request );
69 69
70 70 $query_args = [
71 - 'post_type' => array_keys( $post_types ),
72 - 'numberposts' => $post_count,
73 - 'suppress_filters' => false,
74 - 'custom_search' => true,
75 - 'post_status' => $is_public_only ? 'publish' : 'any',
76 - 'orderby' => 'modified',
77 - 'order' => 'DESC',
71 + 'post_type' => array_keys( $post_types ),
72 + 'numberposts' => $post_count,
73 + 'suppress_filters' => false,
74 + 'custom_search' => true,
75 + 'post_status' => $is_public_only ? 'publish' : 'any',
76 + 'orderby' => 'modified',
77 + 'order' => 'DESC',
78 78 ];
79 +
80 + // for non-admins (contributors), filter by author for private posts
81 + if ( ! $is_public_only && ! current_user_can( 'read_private_posts' ) ) {
82 + $query_args['author'] = get_current_user_id();
83 + }
79 84
80 85 if ( ! empty( $term ) ) {
81 86 $query_args['search_term'] = $term;
82 87 $query_args[ self::SEARCH_IN_CONTENT_KEY ] = $params[ self::SEARCH_IN_CONTENT_KEY ] ?? false;