diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index bd0c920..a3438c5 100644
a
|
b
|
class WP_REST_Comments_Controller extends WP_REST_Controller { |
1437 | 1437 | * |
1438 | 1438 | * @since 4.7.0 |
1439 | 1439 | * |
1440 | | * @param $params JSON Schema-formatted collection parameters. |
| 1440 | * @param array $query_params JSON Schema-formatted collection parameters. |
1441 | 1441 | */ |
1442 | 1442 | return apply_filters( 'rest_comment_collection_params', $query_params ); |
1443 | 1443 | } |
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 4c49504..c037ae2 100644
a
|
b
|
class WP_REST_Posts_Controller extends WP_REST_Controller { |
1985 | 1985 | * @return array Collection parameters. |
1986 | 1986 | */ |
1987 | 1987 | public function get_collection_params() { |
1988 | | $params = parent::get_collection_params(); |
| 1988 | $query_params = parent::get_collection_params(); |
1989 | 1989 | |
1990 | | $params['context']['default'] = 'view'; |
| 1990 | $query_params['context']['default'] = 'view'; |
1991 | 1991 | |
1992 | | $params['after'] = array( |
| 1992 | $query_params['after'] = array( |
1993 | 1993 | 'description' => __( 'Limit response to posts published after a given ISO8601 compliant date.' ), |
1994 | 1994 | 'type' => 'string', |
1995 | 1995 | 'format' => 'date-time', |
1996 | 1996 | ); |
1997 | 1997 | |
1998 | 1998 | if ( post_type_supports( $this->post_type, 'author' ) ) { |
1999 | | $params['author'] = array( |
| 1999 | $query_params['author'] = array( |
2000 | 2000 | 'description' => __( 'Limit result set to posts assigned to specific authors.' ), |
2001 | 2001 | 'type' => 'array', |
2002 | 2002 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2004 | 2004 | ), |
2005 | 2005 | 'default' => array(), |
2006 | 2006 | ); |
2007 | | $params['author_exclude'] = array( |
| 2007 | $query_params['author_exclude'] = array( |
2008 | 2008 | 'description' => __( 'Ensure result set excludes posts assigned to specific authors.' ), |
2009 | 2009 | 'type' => 'array', |
2010 | 2010 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2014 | 2014 | ); |
2015 | 2015 | } |
2016 | 2016 | |
2017 | | $params['before'] = array( |
| 2017 | $query_params['before'] = array( |
2018 | 2018 | 'description' => __( 'Limit response to posts published before a given ISO8601 compliant date.' ), |
2019 | 2019 | 'type' => 'string', |
2020 | 2020 | 'format' => 'date-time', |
2021 | 2021 | ); |
2022 | 2022 | |
2023 | | $params['exclude'] = array( |
| 2023 | $query_params['exclude'] = array( |
2024 | 2024 | 'description' => __( 'Ensure result set excludes specific IDs.' ), |
2025 | 2025 | 'type' => 'array', |
2026 | 2026 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2029 | 2029 | 'default' => array(), |
2030 | 2030 | ); |
2031 | 2031 | |
2032 | | $params['include'] = array( |
| 2032 | $query_params['include'] = array( |
2033 | 2033 | 'description' => __( 'Limit result set to specific IDs.' ), |
2034 | 2034 | 'type' => 'array', |
2035 | 2035 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2039 | 2039 | ); |
2040 | 2040 | |
2041 | 2041 | if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) { |
2042 | | $params['menu_order'] = array( |
| 2042 | $query_params['menu_order'] = array( |
2043 | 2043 | 'description' => __( 'Limit result set to posts with a specific menu_order value.' ), |
2044 | 2044 | 'type' => 'integer', |
2045 | 2045 | ); |
2046 | 2046 | } |
2047 | 2047 | |
2048 | | $params['offset'] = array( |
| 2048 | $query_params['offset'] = array( |
2049 | 2049 | 'description' => __( 'Offset the result set by a specific number of items.' ), |
2050 | 2050 | 'type' => 'integer', |
2051 | 2051 | ); |
2052 | 2052 | |
2053 | | $params['order'] = array( |
| 2053 | $query_params['order'] = array( |
2054 | 2054 | 'description' => __( 'Order sort attribute ascending or descending.' ), |
2055 | 2055 | 'type' => 'string', |
2056 | 2056 | 'default' => 'desc', |
2057 | 2057 | 'enum' => array( 'asc', 'desc' ), |
2058 | 2058 | ); |
2059 | 2059 | |
2060 | | $params['orderby'] = array( |
| 2060 | $query_params['orderby'] = array( |
2061 | 2061 | 'description' => __( 'Sort collection by object attribute.' ), |
2062 | 2062 | 'type' => 'string', |
2063 | 2063 | 'default' => 'date', |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2072 | 2072 | ); |
2073 | 2073 | |
2074 | 2074 | if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) { |
2075 | | $params['orderby']['enum'][] = 'menu_order'; |
| 2075 | $query_params['orderby']['enum'][] = 'menu_order'; |
2076 | 2076 | } |
2077 | 2077 | |
2078 | | $post_type_obj = get_post_type_object( $this->post_type ); |
| 2078 | $post_type = get_post_type_object( $this->post_type ); |
2079 | 2079 | |
2080 | | if ( $post_type_obj->hierarchical || 'attachment' === $this->post_type ) { |
2081 | | $params['parent'] = array( |
| 2080 | if ( $post_type->hierarchical || 'attachment' === $this->post_type ) { |
| 2081 | $query_params['parent'] = array( |
2082 | 2082 | 'description' => __( 'Limit result set to those of particular parent IDs.' ), |
2083 | 2083 | 'type' => 'array', |
2084 | 2084 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2086 | 2086 | ), |
2087 | 2087 | 'default' => array(), |
2088 | 2088 | ); |
2089 | | $params['parent_exclude'] = array( |
| 2089 | $query_params['parent_exclude'] = array( |
2090 | 2090 | 'description' => __( 'Limit result set to all items except those of a particular parent ID.' ), |
2091 | 2091 | 'type' => 'array', |
2092 | 2092 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2096 | 2096 | ); |
2097 | 2097 | } |
2098 | 2098 | |
2099 | | $params['slug'] = array( |
| 2099 | $query_params['slug'] = array( |
2100 | 2100 | 'description' => __( 'Limit result set to posts with one or more specific slugs.' ), |
2101 | 2101 | 'type' => 'array', |
2102 | 2102 | 'items' => array( |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2105 | 2105 | 'sanitize_callback' => 'wp_parse_slug_list', |
2106 | 2106 | ); |
2107 | 2107 | |
2108 | | $params['status'] = array( |
| 2108 | $query_params['status'] = array( |
2109 | 2109 | 'default' => 'publish', |
2110 | 2110 | 'description' => __( 'Limit result set to posts assigned one or more statuses.' ), |
2111 | 2111 | 'type' => 'array', |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2121 | 2121 | foreach ( $taxonomies as $taxonomy ) { |
2122 | 2122 | $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; |
2123 | 2123 | |
2124 | | $params[ $base ] = array( |
| 2124 | $query_params[ $base ] = array( |
2125 | 2125 | /* translators: %s: taxonomy name */ |
2126 | 2126 | 'description' => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ), |
2127 | 2127 | 'type' => 'array', |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2131 | 2131 | 'default' => array(), |
2132 | 2132 | ); |
2133 | 2133 | |
2134 | | $params[ $base . '_exclude' ] = array( |
| 2134 | $query_params[ $base . '_exclude' ] = array( |
2135 | 2135 | /* translators: %s: taxonomy name */ |
2136 | 2136 | 'description' => sprintf( __( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ), |
2137 | 2137 | 'type' => 'array', |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2143 | 2143 | } |
2144 | 2144 | |
2145 | 2145 | if ( 'post' === $this->post_type ) { |
2146 | | $params['sticky'] = array( |
| 2146 | $query_params['sticky'] = array( |
2147 | 2147 | 'description' => __( 'Limit result set to items that are sticky.' ), |
2148 | 2148 | 'type' => 'boolean', |
2149 | 2149 | ); |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
2161 | 2161 | * |
2162 | 2162 | * @since 4.7.0 |
2163 | 2163 | * |
2164 | | * @param $params JSON Schema-formatted collection parameters. |
2165 | | * @param WP_Post_Type $post_type_obj Post type object. |
| 2164 | * @param array $query_params JSON Schema-formatted collection parameters. |
| 2165 | * @param WP_Post_Type $post_type Post type object. |
2166 | 2166 | */ |
2167 | | return apply_filters( "rest_{$this->post_type}_collection_params", $params, $post_type_obj ); |
| 2167 | return apply_filters( "rest_{$this->post_type}_collection_params", $query_params, $post_type ); |
2168 | 2168 | } |
2169 | 2169 | |
2170 | 2170 | /** |
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index 6ca86ca..b8a1390 100644
a
|
b
|
class WP_REST_Terms_Controller extends WP_REST_Controller { |
971 | 971 | * |
972 | 972 | * @since 4.7.0 |
973 | 973 | * |
974 | | * @param $params JSON Schema-formatted collection parameters. |
975 | | * @param WP_Taxonomy $taxonomy_obj Taxonomy object. |
| 974 | * @param array $query_params JSON Schema-formatted collection parameters. |
| 975 | * @param WP_Taxonomy $taxonomy Taxonomy object. |
976 | 976 | */ |
977 | | return apply_filters( 'rest_{$this->taxonomy}_collection_params', $query_params, $taxonomy ); |
| 977 | return apply_filters( "rest_{$this->taxonomy}_collection_params", $query_params, $taxonomy ); |
978 | 978 | } |
979 | 979 | |
980 | 980 | /** |
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
index 01542a9..3179ef3 100644
a
|
b
|
class WP_REST_Users_Controller extends WP_REST_Controller { |
1351 | 1351 | * |
1352 | 1352 | * @since 4.7.0 |
1353 | 1353 | * |
1354 | | * @param $params JSON Schema-formatted collection parameters. |
| 1354 | * @param array $query_params JSON Schema-formatted collection parameters. |
1355 | 1355 | */ |
1356 | 1356 | return apply_filters( 'rest_user_collection_params', $query_params ); |
1357 | 1357 | } |