Create ACF Object Using REST API

[ad_1]

In this documentation: https://www.advancedcustomfields.com/resources/wp-rest-api-integration/#request-methods it mentions three REST methods:

  • GET to view data
  • OPTIONS to request schema
  • POST to update ACF fields

The POST method requires an ID of an already-created object – {ID} in the following:

apiFetch( {
  path: '/wp/v2/book/{ID}',

But what if I don’t already have an ID? Is it possible to create a new ACF object (a new book in this case) instead of modifying an existing one? I want to populate my site with a bunch of historical data, and the API seems like the easiest way to do that, but only if I can create new objects.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer