REST API: Allow querying for multiple `slug` values.

Props jnylen0, rachelbaker.
Fixes #38579.

Built from https://develop.svn.wordpress.org/trunk@39093


git-svn-id: http://core.svn.wordpress.org/trunk@39035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan McCue 2016-11-02 07:14:29 +00:00
parent 624def0ec3
commit 34cf5d8934
2 changed files with 6 additions and 5 deletions

View File

@ -169,7 +169,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
'parent' => 'post_parent__in', 'parent' => 'post_parent__in',
'parent_exclude' => 'post_parent__not_in', 'parent_exclude' => 'post_parent__not_in',
'search' => 's', 'search' => 's',
'slug' => 'name', 'slug' => 'post_name__in',
'status' => 'post_status', 'status' => 'post_status',
); );
@ -882,6 +882,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
'post_parent__not_in', 'post_parent__not_in',
'posts_per_page', 'posts_per_page',
'date_query', 'date_query',
'post_name__in',
); );
$valid_vars = array_merge( $valid_vars, $rest_valid ); $valid_vars = array_merge( $valid_vars, $rest_valid );
@ -2112,9 +2113,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
} }
$params['slug'] = array( $params['slug'] = array(
'description' => __( 'Limit result set to posts with a specific slug.' ), 'description' => __( 'Limit result set to posts with one or more specific slugs.' ),
'type' => 'string', 'type' => 'array',
'validate_callback' => 'rest_validate_request_arg', 'sanitize_callback' => 'wp_parse_slug_list',
); );
$params['status'] = array( $params['status'] = array(

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta1-39092'; $wp_version = '4.7-beta1-39093';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.