Skip to content
This repository was archived by the owner on Apr 4, 2020. It is now read-only.
This repository was archived by the owner on Apr 4, 2020. It is now read-only.

Use meta_key for meta endpoint rather than id #2

Description

@tharsheblows

I've been working through adding in public contexts and using the additional bits in the discussion here: [https://core.trac.wordpress.org/ticket/35658](Provide additional data for registered meta through register_meta) and realised that the way I've done it, it would make more sense to have the individual meta endpoint be the meta_key rather than the meta ID as everything goes as meta_key or meta_key, meta_value. Ie the ID isn't used in update_{$object}_meta or delete_{$object}_meta.

Thought I'd ask about it now before continuing down this path. :)

edit: here's a sample response -- it's not complete and I'm not sure about some things but I hope shows where it's headed

[
  {
    "key": "test_for_hack_day",
    "value": [
      "This is a test for the hack day, hello hello!",
      "The second entry for test_for_hack_day meta key",
      "This is the third"
    ],
    "type": "string",
    "description": "This is the test for hack day description.",
    "_links": {
      "self": [
        {
          "href": "http://src.wordpress-develop.dev/wp-json/wp/v2/posts/10770/test_for_hack_day"
        }
      ],
      "collection": [
        {
          "href": "http://src.wordpress-develop.dev/wp-json/wp/v2/posts/10770/meta"
        }
      ],
      "about": [
        {
          "embeddable": true,
          "href": "http://src.wordpress-develop.dev/wp-json/wp/v2/posts/10770"
        }
      ]
    }
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions