Skip to content
  • Why WPGetAPI?
  • Examples
  • Pricing
  • Plugins
    • PRO Plugin
    • API to Posts Plugin
    • OAuth 2.0 Plugin
  • Docs
  • Support
    • Frequently Asked Questions
    • Feature Request
    • Support Ticket
  • account_circle
PRO Plugin
Howdy! How can we help you?
  • Introduction

    • Quick Start
    • Frequently Asked Questions
    • Will this work with my API?
    • Understanding API docs
    • Step by Step Example
  • Setup

    • Setup Page
    • Endpoint Page
    • Parameters - Query String
    • Parameters - Headers
    • Parameters - Body POST
    • Shortcode
    • Template Tag
    • Gutenberg Block
  • Connecting your API

    • API Key in Headers
    • API Key in Query String
    • Authentication & Authorization
  • Output API Data

    • Format API to HTML
    • Format API to HTML Table
    • Format API to Image Gallery
    • Format JSON Data
  • Integrations

    • Send form data to API
    • WPForms to API
    • Gravity Forms to API
    • Contact Form 7 to API
    • WooCommerce to API
    • WooCommerce API Product Sync
    • wpDataTables to API
    • Connect WordPress to OpenAI
    • Connect RapidAPI to WordPress
    • Connect Zoho CRM to WordPress
    • Page Builders (Elementor, DIVI)
    • Formidable Forms to API
    • Elementor Form to API
    • JetFormBuilder to API
    • Fluent Forms to API
    • WS Form to API
    • Ninja Tables to API
    • Easy Digital Downloads(EDD) API Product Sync
    • Ultimate Member Forms to API
  • Tips & Tricks

    • Filters & Action Hooks
    • Code Snippets Plugin
    • Troubleshooting
    • Code Snippets
  • PRO Plugin

    • Installation
    • Actions
    • Tokens
    • Caching
    • Nested data
    • Chaining API calls
    • Dynamic Variables
    • Format API to HTML
    • Call API on user registration
    • Using AJAX to trigger API call
    • Base64 Encoding
    • Licensing
    • Filters & Action Hooks
  • OAuth 2.0 Plugin

    • Installation
    • How it works
    • Grant Type - Client Credentials
    • Grant Type - Authorization Code
    • Licensing
  • API to Posts Plugin

    • Installation
    • Getting Started
    • Multiple Endpoints
    • Mapping Fields
    • Filters & Action Hooks
    • Pagination

Mapping fields within the API to Posts plugin is relatively straightforward, but at the same time is very powerful. This article takes an in-depth look at how we can map our API data to the fields within WordPress, or within WooCommerce if we are creating products.

First, some definitions

WordPress Fields

We will refer to everything within WordPress as a WordPress field. This could be a custom field, Tags, Categories, Featured Image, Post Title, Post Content or basically any type of data within WordPress.

WooCommerce Fields

This refers to the standard WooCommerce fields such as Regular Price, Sale Price, Attribute, Featured Image, Gallery Images, Weight, Description and so on.

API Keys and Values

The data within an API comes in the form of keys and values. Each key has a corresponding value which might be some text, numbers, an array of data or sometimes the value may be empty or blank.

The key refers to a non-changing name (or key) that is paired up with a variable (or changing) piece of data. An example of a key would be SKU with a corresponding value of 123 for the first item, and then an SKU of 456 for the next item. The key of SKU remains the same but the value changes.


Setting the Post Title

The Post Title is the first field that appears within the Data Mapping section. This field is set up slightly differently to all other mapping fields as it allows you to create a Post Title (or Product Name if creating Products) from multiple different fields within the API.

In the example above, we have simply set the Post Title as the name key.

So the Post Title for the product shown would become ‘ASOS DESIGN oxford lace up shoes in dark brown polished leather with toe cap detail’. Within the Post Title field we could change this to name – id and the post title would include ‘ – 204263709’ at the end of it as we are now adding the id key to the field.


Using Array Data

If your API value is in the form of an array (including multiple sub-arrays), an extra field will appear that allows you to step down into the array to grab any value you require.

In the example above, we want to set the Regular Price and grab the value that is buried a couple levels deep in the array. The first level key is current and the second level key is value. So in our field we just need to add {current|value} and this will step down and grab the value of 79.99 for this product.


The Add Row Button

You will notice that beneath each of the values, there is an Add Row button. This allows you to use values multiple times or to extract multiple values from an array.

Here we are using the imageUrl value to create our Featured Image and also to add the value into a custom field named imageurl.


Custom Fields

There are a few different options with the way we can store custom fields.

Single Field

This example uses the Custom Field option and simply stores the value in a single custom field named ‘blah’.

If your value is an array and you use the single Custom Field option, it will JSON encode the array and store it within the single custom field as JSON data.

Multiple Fields

If your API value is an array you can select the Custom Fields (multiple fields when array) and this will create multiple fields that look something like this:

  • Name of custom field: price_current_value – Value of custom field: 79.99
  • Name of custom field: price_current_text – Value of custom field: $79.99
  • Name of custom field: price_previous_value – Value of custom field:
  • Name of custom field: price_current_value – Value of custom field:
  • Name of custom field: price_currency – Value of custom field: USD
  • and so on…

Warning: if the array is large, it will create many many custom fields.


Images

Images can be uploaded by using the Featured Image or Gallery Images (when creating WooCommerce products). Simply select the Featured Image option and the URL of the image will be called, the image uploaded into your Media Library and assigned to the post.

Note that this will slow down the post creation process as each image requires an API call as well as processing the image and uploading to the website.

On this page
contact_support

Still not sure?

APIs can be daunting and sometimes downright confusing.

But we are here to help! Our support is amazing and we can assist you with any setup required and ensure your API integrations are a success!

Ask Us Anything

Connect your WordPress website to external APIs without writing a single line of code. Send data from WordPress to your API or display data from your API within WordPress.

Support

  • Documentation
  • Support Ticket
  • Refund Policy
  • Contact Us
  • About Us
  • Affiliates

Articles

  • Quick Start Guide
  • WooCommerce Orders to API
  • WooCommerce API Products Sync
  • Contact Form 7 to API
  • WPForms to API
  • Gravity Forms to API
  • WordPress to RapidAPI

WordPress API Plugins

  • Free WPGetAPI Plugin
  • PRO Plugin
  • API to Posts Plugin Plugin
  • OAuth 2.0 Authorization Plugin

© 2025 WPGetAPI. All Rights Reserved.

"*" indicates required fields

Name*
This field is for validation purposes and should be left unchanged.