WP Manifestindependent plugin directory
manifest / integrations / cmb2-rest-query

Query parameters in REST API for CMB2 fields

Adds a query parameter to the REST API for any CMB2 field that has the property rest_query set on it.

★ 1stars
5composer installs

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/dutchigor/cmb2-rest-query/archive/refs/heads/master.zip

On Packagist as dutchigor/cmb2-rest-query:

composer require dutchigor/cmb2-rest-query
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
CMB2-rest-query Adds a query parameter to the REST API for any CMB2 field that has the property restquery set on it. How to install Option one - Clone or download and unzip this plugin in to your WordPress plugin directory and active. Option two - Add dutchigor/cmb2-rest-query to required packages in composer and require CMB2-rest-query.php in your code How to use Setting up the metabox in CMB2 Add the queryrest property to the field that you wish to query by in your CMB2 field configuration. - If set to true, the field ID will used to query the REST API. - If set to a value, the value will be used to query REST API. Example Querying the REST API For each field that has restquery set, 3 parameters will be available in the REST request on each post type that this field's metabox is registered on: - the field's restquery value or id (as defined above) - the above parameter appended with compare - the above parameter appended with type Adding the field's query parameter to the request will add that field to the request's meta query. By default compare will be '=' but using the {restquery}compare parameter, this can be changed to any option allowed by WPMetaQuery. The type of the