[wordpress] REST API — update/create/read Post, Custom Post type(CPT) with ACF

Peter Chang
2 min readNov 30, 2021

--

1. Create an App account to use in API

Install the plugin Application Passwords Enable:

And go to user pace on the admin dashboard, to create a password for API:

https://example.com/wp-admin/authorize-application.php

2. Setting up authentication method on the APIs

In this step, you will need to setup Basic Auth on Authorization method, and use the username and password which are generated on Step1.

To the Read(GET) post methods are always public, however post, put method are required auth.

3. Updating/Creating Post or Custom Post Type

I have created a CPT(Custom Post type) through CPT UI plugin, called Skills.

We can easily update/create the default/origin fields of post by API, as the configuration on Postman. However, I am a user who is heavily using ACF(Advanced Custom Field), let talk about manipulating ACF fields on the APIs.

4. Updating/Creating ACF field or Post

I have created a CPT(Custom Post type) through CPT UI plugin, called Skills.

Turn on Show in REST API option on the Group Field

Since the Show in REST API is turn on, you will be easily read or update ACF fields as below.

Reference:

--

--

Peter Chang
Peter Chang

No responses yet