The WordPress REST API is a powerful tool for programmers to generate content dynamically using post and page API POST calls. You can populate the standard fields such as the title, the permalink (slug), category, content of the page and more using the standard API calls. This is great for standard web pages, but has one main limitation: support for plugins. In this post, we’ll show you how to generate a wordpress post with plugin fields configured using the WordPress REST API.

  1. Install the Pericror REST API Meta Support plugin. This is needed to update the post meta fields, which plugins read from to get their settings.
  2. Create a test Post from the WordPress Dashboard in which you have the plugins you want to configure.Configure the plugins with the settings you want.
  3. Using a browser with developer tools (I will be using Chrome), open the Network traffic view:
    1. Open Developer Tools (Ctrl+Shift+I)
    2. Click on the ‘Network’ tab, check ‘Preserve Log’, and update the Filter to ‘post’
    3. Keep this window open

  4. Click the ‘Save Draft’ button from the WordPress Publish box. This will send all of the data from your browser to your WordPress site, and allow you to see which fields are being set for the plugins!
  5. Returning to your Network tab, click on the first “post.php” entry.
  6. Scroll down the ‘Headers’ section until your reach ‘Form Data’. This contains all of the field names your plugin may have set associated with the post you will need to pass into the ‘meta’ field of your REST API data! Scroll through the field names to find the fields associated with your plugin.
  7. If I was looking for the Widget After Content and Yoast SEO fields, I would find them here:
  8. If a field appears to have no corresponding value (i.e ‘field:’ instead of ‘field:value’), it means the default values of the field are set and you don’t need to configure this field.
  9. When populating the ‘meta’ section of your WordPress REST API page or post POST data, simply add the key value pairs you found above to configure the plugin fields from the REST API!