WP REST Filter (wp-rest-filter) free WordPress plugin

Free Plugin134 websites
WP REST Filter (wp-rest-filter) free WordPress plugin by SK8Tech

Since WordPress 4.7 the filter argument for any post endpoint was removed.

This plugin restores the filter parameter for websites that were previously using it.

Usage

Use the filter parameter on any Post, or Custom Post Type endpoint such as /wp/v2/posts or /wp/v2/cpt as an array of WP_Query
argument. ACF values are also supported.

Default Post Type

fetch( 'https://domain.com/wp-json/wp/v2/posts?filter[meta_key]=acfkey&filter[meta_value]=acfvalue');

Filter Users

fetch( 'https://domain.com/wp-json/wp/v2/users?filter[meta_key]=acfkey&filter[meta_value]=acfvalue');

Custom Post Type

fetch( 'https://domain.com/wp-json/wp/v2/cars?filter[meta_key]=currency&filter[meta_value]=AUD'); // here 'cars' is the endpoint for CPT

Advanced Custom Field

fetch( 'https://domain.com/wp-json/wp/v2/cars?filter[meta_key]=price&filter[meta_compare]=<&filter[meta_value]=200000'); // Query for car 'less' than '200000' in 'price'

Advanced Custom Field – By Date (before, equal & after)

fetch( 'https://domain.com/wp-json/wp/v2/cars?filter[meta_key]=expiry_date&filter[meta_value]=2018-12-27T23:59:59&filter[meta_compare]=< // 'Expiry' Before '2018 Boxing Day ends'

Advanced Custom Field – Value in Array (Single Value)

fetch( 'https://domain.com/wp-json/wp/v2/cars?filter[meta_key]=features&filter[meta_compare]=LIKE&filter[meta_value]=electric

Advanced Custom Field – Search

fetch( 'https://domain.com/wp-json/wp/v2/cars?filter[meta_key]=brands&filter[meta_compare]=LIKE&filter[meta_value]=tesla

Multiple Meta Queries

fetch( 'https://domain.com/wp-json/wp/v2/cars?filter[meta_query][0][key]=currency&filter[meta_query][0][value]&filter[meta_query][1][key]=country&filter[meta_query][1][value]=Australia'); // here 'cars' is the endpoint for CPT

Technical Support

SK8Tech – Customer Success Specialist offers Technical Support to configure or install WP REST Filter.

Our Services

  • SK8Tech Sydney Web Design
  • SK8Tech Enterprise Email Hosting
  • SK8Tech Emergency IT Support
  • SK8Tech WeChat Advertising

Contact Us

Based in Sydney, SK8Tech is a innovative company providing IT services to SMEs, including Web Design, App Development and more.

Author: SK8Tech

Plugin folder: wp-rest-filter

Tags: api, filter, rest, rest-api, wp

image.pngimage.pngimage.png