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.

by Igor Honhoff · github.com/dutchigor/cmb2-rest-query · website

1stars
5composer installs
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

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

Also on Packagist as dutchigor/cmb2-rest-query:

composer require dutchigor/cmb2-rest-query

From the readme

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

Read the full README on GitHub →