How to Import and Export Data with Advanced Custom Fields (ACF)
Content
Many WordPress developers and site builders use Advanced Custom Fields (ACF) to create rich, structured content. A common challenge that arises is moving this structured data between environments, integrating with external systems, or performing bulk updates. This guide covers the core concepts and most effective methods for importing and exporting ACF data.
Understanding the Core Challenge
ACF does not include a built-in, one-click tool for importing or exporting field values or post content. The native Tools > Export feature in the ACF admin interface is designed specifically for exporting field group definitions (their structure, settings, and rules), not the content you create with those fields. This distinction is crucial for planning your data workflow.
Common Solutions for Importing and Exporting Data
1. Using Dedicated Import/Export Plugins
The most common solution for moving ACF field values is to use a third-party plugin designed for WordPress import/export tasks. These plugins map CSV columns to WordPress post data and custom field names.
- WP Ultimate CSV Importer: As mentioned in the sample threads, this plugin has support for importing data into ACF fields.
- WP All Import: Another popular, powerful import plugin that explicitly supports ACF.
How it works: These plugins typically require your CSV file to have a column whose header matches the ACF field's name or key. During the import process, you can map these columns to the corresponding custom fields in your WordPress database.
2. Leveraging the WordPress REST API
For developers, the WordPress REST API provides a powerful way to create and update content with ACF data programmatically. This is ideal for building custom integrations or importing historical data from another system.
- To update ACF fields on an existing post, use a POST request to the endpoint for that post type (e.g.,
/wp/v2/posts/{ID}). Include your ACF data in the request body under theacfproperty. - To create a new post with ACF data, first use a POST request to create the base post object. The API will return a new post ID. You can then immediately use a second POST request to that new ID to populate its ACF fields.
3. Exporting Data for External Use (e.g., Google Sheets)
To get ACF data out of WordPress and into a system like Google Sheets, you often need to extend WordPress's built-in capabilities.
- ACF to REST API: This free plugin exposes ACF field data in the native WordPress REST API responses, making it much easier for external services like Zapier or Make to fetch the data.
- Custom Code: For a direct export, you can write a custom function in your theme's
functions.phpfile that queries the posts and ACF data you need, formats it, and triggers a CSV download. This can be triggered by a special URL or an admin button.
Key Considerations and Troubleshooting Tips
- Field Type Matters: Complex field types like Repeaters, Flexible Content, and Multi-Select may require special handling in your import CSV or custom code. They often need to be formatted as serialized arrays or JSON strings.
- Field Name vs. Field Key: Some tools may require the ACF field key (e.g.,
field_5e8207c19) instead of the field name. Check your tool's documentation. - User Permissions: Any operation through the REST API or a custom export function will require proper authentication and user capabilities.
By understanding the difference between field group definitions and field values, you can choose the right method—whether it's a dedicated plugin, the REST API, or custom code—to successfully manage your ACF data import and export needs.
Related Support Threads Support
-
Multi-select options not showing up when importing data from NetSuitehttps://wordpress.org/support/topic/multi-select-options-not-showing-up-when-importing-data-from-netsuite/
-
Can’t Export and Import all contentshttps://wordpress.org/support/topic/cant-export-and-import-all-contents/
-
Import into via CSV?https://wordpress.org/support/topic/import-into-via-csv/
-
récupération des donnéeshttps://wordpress.org/support/topic/recuperation-des-donnees-2/
-
Import fields from pathhttps://wordpress.org/support/topic/import-fields-from-path/
-
Create ACF Object Using REST APIhttps://wordpress.org/support/topic/create-acf-object-using-rest-api/
-
Export Advanced Custom Fields from post to .CSVhttps://wordpress.org/support/topic/export-advanced-custom-fields-from-post-to-csv/
-
Import ACF fields from generated php file of acf fields.https://wordpress.org/support/topic/import-acf-fields-from-generated-php-file-of-acf-fields/
-
importing into custom field is not an option?https://wordpress.org/support/topic/importing-into-custom-field-is-not-an-option/
-
display a set of data – gathered by a query against osm-endpointhttps://wordpress.org/support/topic/display-a-set-of-data-gathered-by-a-query-against-osm-endpoint/
-
Fetch data from outside & display them in a widgethttps://wordpress.org/support/topic/fetch-data-from-outside-display-them-in-a-widget-2/
-
Save json files to different foldershttps://wordpress.org/support/topic/save-json-files-to-different-folders/