Skip to content

Commit 46e8016

Browse files
committed
Merge branch 'develop'
2 parents 8e99714 + f016d27 commit 46e8016

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

better-wp-endpoints.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Better WordPress Endpoints
44
Plugin URI: https://github.com/factor1/better-wp-endpoints/
55
Description: Serves up slimmer WordPress Rest API endpoints, with some great enhancements.
6-
Version: 0.1.21
6+
Version: 0.1.22
77
Author: Eric Stout, Factor1 Studios
88
Author URI: https://factor1studios.com/
99
License: GPL3

includes/get_posts.php

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function bwe_get_posts( WP_REST_Request $request ) {
1313
$posts_per_page = $request['per_page']?: '10';
1414
$page = $request['page']?: '1';
1515
$category = $request['category']?: null;
16+
$category_name = $request['category_name']?: '';
1617
$tag = $request['tag']?: null;
1718
$show_content = $request['content']?: true;
1819
$orderby = $request['orderby']?: null;
@@ -26,6 +27,7 @@ function bwe_get_posts( WP_REST_Request $request ) {
2627
'posts_per_page' => $posts_per_page,
2728
'paged' => $page,
2829
'cat' => $category,
30+
'category_name' => $category_name,
2931
'tag_id' => $tag,
3032
'order' => $order?:'DESC',
3133
'orderby' => $orderby?:'date',
@@ -232,6 +234,14 @@ function bwe_get_posts( WP_REST_Request $request ) {
232234
},
233235
'sanitize_callback' => 'sanitize_text_field',
234236
),
237+
'category_name' => array(
238+
'description' => 'Query the collection by category slug.',
239+
'type' => 'string',
240+
'validate_callback' => function($param, $request, $key) {
241+
return is_string( $param );
242+
},
243+
'sanitize_callback' => 'sanitize_text_field',
244+
),
235245
),
236246
) );
237247
} );

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "better-wp-endpoints",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Serves up slimmer WordPress Rest API endpoints.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)