Custom Fields
Re-Envisioned
Support General MB Rest API Fields POST Method

  • Creator
    Topic
  • #6451
    alpha.media
    Participant

    I am trying to use the WP Rest API to post data to fields that start with an _ and it appears to not allow posting to these fields. Do you know a workaround or a way to make it work with fields that start with an underscores that doesn’t involve changing the meta key name?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #6452
    alpha.media
    Participant

    To clarify, the meta fields are showing properly when using a GET request to the endpoint, they just don’t seem to update with an underscores. This was working a few months ago and i’m not sure what happened but it stopped working.

    #6462
    Anh Tran
    Keymaster

    Hi, POST works, actually.

    Here is the code that implements that.

    You can send data in json format (string) or an array in format (field_id => value).

    #6463
    alpha.media
    Participant

    Interesting. The strange thing is this was all working previously and when I went to retest it wasn’t working. Keep in mind the Meta Box fields that don’t begin with an underscores are working properly. Only protected meta with an underscores that is setup as MB fields won’t update but any of the others will just fine. I’ll have to take a look and see if there is something else within WordPress that could have updated to cause this.

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

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash