Custom Fields
Re-Envisioned
Support MB REST API Selective fetch meta data via rest api

  • Creator
    Topic
  • #32733
    Dave
    Participant

    Hi,

    I'm probably doing something wrong, but I'm trying to fetch a restricted set of meta fields from a post using the REST API.

    /wp-json/wp/v2/book/16

    Returns a field containing all data

        "meta_box": {
            "url": "https://google.com",
            "text": "asdfasdf"
        },

    But when I try to select a single value I get 0 values.

    /wp-json/wp/v2/book/16?_fields=meta_box

    returns

    "meta_box": [],

    What I am trying to get is a query that returns only specific Meta Box values. ie just meta_box.url

    eg /wp-json/wp/v2/book/16?_fields=title.rendered,excerpt.rendered,meta_box.url

    to get something like

        "title": {
            "rendered": "The Harder We Fall"
        },
        "excerpt": {
            "rendered": "<p>Insomnia. It’s part of the penance I pay for my greatest mistake. But when an ill-timed doze behind the wheel of my car nearly introduces me to a pole, I know something has to change.</p>\n"
        },
        "meta_box": [
           "url": "https://google.com"
    ],

    My googling has returned nothing useful for me. Your assistance would be appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.