Skip to content

Adds Advanced Custom Post Fields to WP REST API V2 JSON output.

Notifications You must be signed in to change notification settings

Vatsov/wp-rest-api-v2-custom-post-fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Adds Advanced Custom Post Fields to WP REST API V2 JSON output.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages