I am constructing a web site with wordpress API. I am utilizing Superior Customized Fields, and in addition ACF to Relaxation API plugin to reveal ACF information in API: https://github.com/airesvsg/acf-to-rest-api
Now I am attempting to filter the response by ACF values. I used to be capable of finding this piece of code that helps with that:
add_filter( 'rest_product_query', operate( $args ) {
$ignore = array('per_page', 'search', 'order', 'orderby', 'slug');
foreach ( $_GET as $key => $worth ) {
if (!in_array($key, $ignore)) {
$args['meta_query'][] = array(
'key' => $key,
'worth' => $worth,
);
}
}
return $args;
});
Now I will filter queries like so: https://instance.com/wp-json/wp/v2/product?size=Customizable
The issue with that is that, now I am not capable of entry api pages like https://instance.com/wp-json/wp/v2/product?web page=2
, which I would like to have the ability to do.
Any method to refactor this to nonetheless be capable of use default wordpress API filters/search conduct?
Or, any various higher method to do the identical factor?