Support

Account

Home Forums General Issues WordPress Post to Custom Field

Solved

WordPress Post to Custom Field

  • I’m looking for some community support with the issue I’m having.

    I’m doing a local test on a local install of wordpress 5.6. I have a basic install of wordpress with the ACF Custom field plugin and the ACF to Rest API plugin.

    I created a custom field called “book_link”.
    I’m able to do a GET to retrieve the custom field showing up in the API call.

    I’ve got the authentication working and I’ve also been able to do a post however I cannot seem to get the custom data to post.

    My json response includes this info:

        "acf": {
            "book_link": "https://google.com"
        },

    I tried using this in the body through POSTMAN for testing. The title, content and status gets posted however the book_link fails.

    {
    "title":"Post Testing",
    "content":"This is a test post",
    "status":"publish",
    "acf": {
            "book_link": "wordpress.com"
        }

    I’ve also tried this with no luck.

     {
    "title":"Post Testing",
    "content":"This is a test post",
    "status":"publish",
    "book_link": "wordpress.com" }

    Can someone point me in the right direction? I thought it might be a meta field but with the “acf” showing up in the json response, it confused me a bit.

  • Hi @paulsvang,
    I have exactly the same problem as you.
    Did you found a way ?

    I have an other idea, but sounds heavy :
    1- Create a post with the standard API
    2- Get the ID after the creation
    3- Use the extension ACF TO REST API and do an update of the initial post just to fill up ACF fields.

    We can exchange about this together if you want (as we are in the same boat apparently ^^)

  • @paulsvang

    I found the solution here : https://stackoverflow.com/questions/56553090/populate-acf-fields-using-wordpress-rest-api-js

    Just replace acf by fields like this :

    "fields": 
        {      
            "field_1" : "Titre",  
            "field_2" : 100
        }
  • @djoo Thanks. I appreciate you posting the solution. I found the same link and it worked but I forgot to post it here in case others have the same issue.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.