question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create post with ACF field values

See original GitHub issue

Hi, Thanks for this wonderful API,

I am trying to create post with ACF field values, but API creates the post with title and content only and skips the ACF field values. Event I tried to update the ACF field value it throws following error

{ 
code: 'cant_update_item',
  message: 'Cannot update item',
  data: { status: 500 }
 }

I referred the #176 as well

Find the code snippet below screen shot 2017-10-10 at 9 09 24 am

Someone help to sort out this. Sample code will be more helpful. Thanks in advance.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:10

github_iconTop GitHub Comments

7reactions
gallaouimcommented, Nov 15, 2017

im using this wonderful api to update my products too , u can update your acf fields this way , after registering your endpoint for example

wp.productsAPI = wp.registerRoute("wp/v2", "/products/");

this code snippet will create a new post that support acf fields

wp
  .productsAPI()
  .create({
    title: "Post number",
    fields: {
      product_name: "product name",
      product_description: "product description",
       categories: [
        { category_name: "category1" },
        { category_name: "category2" }
      ]
    },
    status: "publish"
  })

elements under fields are the acf fields , and categories is a repeater field 😃

1reaction
donnieriskcommented, Dec 21, 2017

I had exactly the same issue, thank you @gallaouim this worked for me!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can\'t get the name value to use $_POST - ACF Support
I'm using a ACF Form on one of my pages (on the front-end) which all works fine. But I need some of the...
Read more >
How to create title post from ACF custom field value
Hello,. I would like to know how to implement ACF custom field to default post title so the title could go from (default...
Read more >
Advanced custom fields: can't query posts by custom field
According to this question/answer on the ACF forum:.
Read more >
How to Create a Smart Tag from an ACF Field - WPForms
However, when the authors create their posts to sell, they'll need to be able to enter a price for their item. We've used...
Read more >
JetSmartFilters: How to Use Filters With the ACF Meta Fields
Now you have to add the options manually by clicking the “New Option” button in the Options List field. Make sure the Values...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found