Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 2.6 KB

File metadata and controls

69 lines (45 loc) · 2.6 KB

WP REST API V2 Custom Post Fields

Banner
Shows Advanced Custom Field output to the WP REST API V2 for posts.


- [Description](#description) - [Installation](#installation) - [Filters](#filters) - [Changelog](#changelog)

Description

This plugin combines the two of the best WordPress plugins: WP REST API and Advanced Custom Fields.
Support and Requests please in GitHub.

Installation

This plugin requires having WP REST API and Advanced Custom Fields installed and activated or it won't be of any use.

  • Manual Installation:
    Upload the entire /wp-rest-api-v2-custom-post-fields directory to the /wp-content/plugins/ directory.

  • Better Installation:
    Go to Plugins > Add New in your WordPress admin and search for 'WP REST API V2 Custom Post Fields'.

Once installed, activate 'WP REST API V2 Custom Post Fields' from WordPress plugins dashboard page and you're ready to go.

This plugin works straight out of the box.

Filters

Endpoint
/wp-json/wp/v2/posts?filter[meta_key]={custom-field-name}&filter[meta_value]={custom-field-value}

If you want to limit the fields you have to add the allowed meta keys in 'allowed_meta_keys' array in plugin.php

$allowed_meta_keys = array( 'custom-field-name' );

Changelog

0.2 - (29 April 2016)

  • Allow filter by meta key/value.

0.1 - (10 April 2016)

  • Initial Release.


Props [Deyan Vatsov](https://github.com/Vatsov)