Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with WpApiCustom #40

Open
LAURENS-Damien opened this issue Apr 25, 2018 · 0 comments
Open

Update with WpApiCustom #40

LAURENS-Damien opened this issue Apr 25, 2018 · 0 comments

Comments

@LAURENS-Damien
Copy link

Hello,

I try to use wpApiCustom for update a custom post whitch use ACF (Advanced Custom Fields). Here are the data to update :
{"id":92,"date":"2018-03-07T21:50:46","date_gmt":"2018-03-07T20:50:46","guid":{"rendered":"http://localhost/?post_type=evenements&p=92"},"modified":"2018-04-25T22:21:06","modified_gmt":"2018-04-25T20:21:06","slug":"1er-evenement","status":"publish","type":"evenements","link":"http://localhost/evenements/1er-evenement/","title":{"rendered":"remimartin_adm"},"content":{"rendered":"

Evenement1|08/03/2018</p>\n","protected":false},"template":"","acf":{"id":"1","nom_de_levenement":"Event1","date_de_levenement":"07/03/2018"},"_links":{"self":[{"href":"http://localhost/wp-json/wp/v2/evenements/92"}],"collection":[{"href":"http://localhost/wp-json/wp/v2/evenements"}],"about":[{"href":"http://localhost/wp-json/wp/v2/types/evenements"}],"wp:attachment":[{"href":"http://localhost/wp-json/wp/v2/media?parent=92"}],"curies":[{"name":"wp","href":"https://api.w.org/{rel}","templated":true}]}}

I try to use wpApiCustom like this but it doesn't work :
this.eventToUpdate = wpApiCustom.getInstance('evenements').update(92, { "acf" : [{"nom_de_levenement": "newName"}] })
.toPromise()
.then(response => response.json())
.catch(error => {});

Is it possible to update an ACF whith wpApiCustom and if yes, what is the correct syntax?

Thanks for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant