Giter Site home page Giter Site logo

recursive-acf-to-wp-rest-api's Introduction

Recursive ACF To WP REST API (v2)

This is a WordPress plugin which recursively appends Advanced Custom Fields Data to the WP REST API v2 for both standard objects and custom posts.

Requirements

Installation

  • Install into the wp-content/plugins directory
  • Activate from the Plugins > Installed Plugins panel in WordPress admin

Example

  • curl http://localhost/wp-json/v2/wp/myobject/1
Standard Response
{
  id: 1,
  date: "2016-06-05T21:33:59",
  date_gmt: "2016-06-05T21:33:59",
  guid: {...},
  modified: "2016-06-09T18:15:05",
  modified_gmt: "2016-06-09T18:15:05",
  slug: "myobject-slug",
  type: "myobject",
  link: "http://localhost/myobject/myobject-slug/",
  title: {...},
  featured_media: 0,
  _links: {...}
}
Response With Plugin
{
  id: 1,
  date: "2016-06-05T21:33:59",
  date_gmt: "2016-06-05T21:33:59",
  guid: {...},
  modified: "2016-06-09T18:15:05",
  modified_gmt: "2016-06-09T18:15:05",
  slug: "myobject-slug",
  type: "myobject",
  link: "http://localhost/myobject/myobject-slug/",
  title: {...},
  featured_media: 0,
  _links: {...}
  acf: {
    technologies: [
      {
        ID: 1,
        post_author: "1",
        post_date: "2016-06-05 21:28:59",
        post_date_gmt: "2016-06-05 21:28:59",
        post_content: "",
        post_title: "PHP",
        post_excerpt: "",
        post_status: "publish",
        comment_status: "closed",
        ping_status: "closed",
        post_password: "",
        post_name: "php",
        to_ping: "",
        pinged: "",
        post_modified: "2016-06-05 21:28:59",
        post_modified_gmt: "2016-06-05 21:28:59",
        post_content_filtered: "",
        post_parent: 0,
        guid: "http://localhost/?post_type=technology&p=1",
        menu_order: 0,
        post_type: "technology",
        post_mime_type: "",
        comment_count: "0",
        filter: "raw",
        acf: {
          icon: "php",
          description: "<p>Custom post with two custom fields.</p>"
        }
      }
    ],
    faqs: [
      {
        question: "What is this?",
        answer: "This is a repeater custom field for custom post myobject."
      }
    ]
  }
}

recursive-acf-to-wp-rest-api's People

Contributors

frosso avatar nyanofthemoon avatar

Watchers

 avatar

Forkers

frosso

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.