dev-master
9999999-dev https://github.com/Shelob9/jp-tax-queryAdds a tax-query endpoint to the WordPress REST API
GPL-2.0+
The Requires
- composer/installers ~1.0.0
- php >=5.3.0
by Josh Pollock
wordpress rest-api
Wallogit.com
2017 © Pedro Peláez
Adds a tax-query endpoint to the WordPress REST API
Adds a tax_query endpoint to the jp-api route or the WordPress REST API (WP-API). You can pass, in the body of the request a tax_query. See the codex for information on how to make one of those. The request's body can have 'post_type' and 'tax_query' arguments only. All other arguments will be stripped out before passing to WP_Query so don't try it., (*1)
This endpoint does NOT require authentication. Please consider whether or not you really want the whole internet to be able to run tax queries on your site before using., (*2)
The REST API only lets you filter by one term per taxonomy. This gives you all of the powers of tax_queries., (*3)
define( 'JP_API_ROUTE', 'skywalker' );, (*4)
Endpoint is now skywalker/tax_query, (*5)
This is not a plugin., (*6)
The correct way to add it is to add "shelob9/jp-tax-query": "dev-master" to your site/plugin/theme's composer.json. Include composer autoloader., (*7)
Alternatively, add this repo to your site/plugin/theme using a Git Submodule or by employing the dark art of copypasta., (*8)
$args = array(
'post_type' => 'post',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'movie_genre',
'field' => 'slug',
'terms' => array( 'action', 'comedy' ),
),
array(
'taxonomy' => 'actor',
'field' => 'id',
'terms' => array( 103, 115, 206 ),
'operator' => 'NOT IN',
),
),
);
$response = wp_remote_get( json_url( 'jp-api/tax-query') , array( 'body' => json_encode( $args ) ) );
Copyright 2014 Josh Pollock. Licensed under the terms of the GNU General public license version 2. Please share with your neighbor., (*9)
Adds a tax-query endpoint to the WordPress REST API
GPL-2.0+
wordpress rest-api