Risk Free, Backed By Our 90-Day Money Back Guarantee
 - 
Read More
Lifetime Licenses Are Ending Soon, Get Yours Before They're Gone
 - 
Read More
Risk Free, Backed By Our 90-Day Money Back Guarantee
Pricing

You may have seen some references on our site to annual licensing or renewals.

All plugins currently come with a lifetime license, no matter what the site says.

We’re currently running tests before we make the switch to annual pricing. Check the Discounts tab to purchase our other plugins and get a lifetime license before they’re gone.

I Understand I Have a Lifetime License
Now is your last chance to buy a lifetime license before we switch to annual pricing. Existing licenses will be unaffected.
Read More
200,000+ Active Installs
1500+ 5 Star Reviews
Docs Menu

The best import export plugin for WordPress & WooCommerce.

Complete, granular control of your data with an easy to use drag & drop interface.
  • 90 Day Money Back Guarantee
  • Unlimited Installs
  • Lifetime Licence
  • Fast, World-Class Support
Get Started
90 Day Money Back Guarantee

Advanced: Support Your Custom ACF Field Types

Advanced Custom Fields allows you to create your own type of field. This may be necessary to save & load unique data. This guide will teach you how to enable support for these custom field types.

What Are Custom ACF Field Types

These are field types created to handle specific data pieces that can't be handled using the default field types provided by ACF. To learn more about how this works, you can read ACF's documentation: Creating a new field type.

Following the acf-example-field-type provided by ACF, we have modified that same example field to be a 'soflyy_field' type instead.

All code examples shared here can be added to your child's theme functions.php file or in a plugin like Code Snippets.

Step 1: Define the New Class Required

You first define the class to use for your new field type. The code requires that you have a class defined with the expected methods and properties. It must extend the Field class defined in wpai_acf_add_on\fields\Field.

As a starting point, we used the existing FieldText class as a template (found in wpai-acf-add-on/src/fields/acf/FieldText.php).

The class should have, at a minimum:

  • The $type property.
  • A 'parse' method. 
  • An 'import' method.

Here's our new class to import the new 'soflyy_field' type.

namespace wpai_acf_add_on\fields\acf;

use wpai_acf_add_on\ACFService;
use wpai_acf_add_on\fields\Field;

/**
 * Class FieldSoflyyField
 * @package wpai_acf_add_on\fields\acf
 */
class FieldSoflyyField extends Field {

    /**
     *  Field type key
     */
    public $type = 'soflyy_field';

    /**
     *
     * Parse field data
     *
     * @param $xpath
     * @param $parsingData
     * @param array $args
     */
    public function parse($xpath, $parsingData, $args = array()) {
        parent::parse($xpath, $parsingData, $args);
        $values = $this->getByXPath($xpath);
        $this->setOption('values', $values);
    }

    /**
     * @param $importData
     * @param array $args
     * @return mixed
     */
    public function import($importData, $args = array()) {
        $isUpdated = parent::import($importData, $args);
        if (!$isUpdated){
            return FALSE;
        }
        ACFService::update_post_meta($this, $this->getPostID(), $this->getFieldName(), $this->getFieldValue());
    }
}

When the import runs, the import method from this defined class will be called to handle the actual saving of your custom ACF field type. 

We have stored this class file in a small custom WordPress plugin.

Step 2: Load the Newly Defined Class

Use the filter 'wp_all_import_acf_field_class' to load the class you just defined. Here's the code to load the new class FieldSoflyyField that we have just created:

function my_soflyy_field( $class , $fieldData, $post, $fieldName, $fieldParent ) {
	if ($fieldData['type'] == 'soflyy_field'){
		// Check if the class is not already defined
        if (!class_exists('\wpai_acf_add_on\fields\acf\FieldSoflyyField')) {
            // Include the file containing the FieldSoflyyField class from our custom plugin
            require_once MY_CUSTOM_PLUGIN_ROOT_DIR . '/classes/FieldSoflyyField.php';
        }
		return '\wpai_acf_add_on\fields\acf\FieldSoflyyField';
	} else {
		return $class;
	}
}
add_filter( 'wp_all_import_acf_field_class', 'my_soflyy_field', 10, 5 );

Note that the class you return must already be defined in PHP, as WP All Import will only check if it exists and then create an object using it. It won't try to automatically load the file containing it.

Step 3: Define the View in the Import Screen

Once you've defined the class and enabled it via the correct hook, you can load the PHP view file that will show the input field when this field type is being mapped in Step 3 of the import process.

Here's our SoflyyField.php view file:

<input
    type="text"
    placeholder=""
    value="<?php echo esc_attr( $current_field );?>"
    name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]"
    class="text widefat rad4"/>

For this example, we have uploaded the view file to our small custom WordPress plugin, and then we've loaded that file using the wp_all_import_acf_field_view_path_soflyy_field hook. Here's the relevant code:

function my_path_soflyy_field( $filePath, $field ) {
	$customFile = MY_CUSTOM_PLUGIN_ROOT_DIR . '/views/SoflyyField.php';
	return $customFile;
}
add_filter( 'wp_all_import_acf_field_view_path_soflyy_field', 'my_path_soflyy_field', 10, 2 );

You have to update the filter name and swap 'soflyy_field' with your own field type slug, as this filter name is dynamic.

After including all of the required code, you'll be able to see the correct input field for your new field type when mapping the import template. Here's how our example looks:

Custom ACF Field Type Soflyy Field Example

Import to ACF from any CSV, Excel, and XML

  • Every ACF Field
  • Any file format
  • Any data structure
  • Inline PHP
  • Images, galleries, repeaters, and more
  • Woo, Meta Box, JetEngine
  • Any theme or plugin

Other Hooks to Enable Support for Your Own ACF Field Type

Here's more information on the other available hooks that can be used when enabling support for your own ACF field type:

wp_all_import_acf_field_view_dir_soflyy_field

Used to specify the location of the header and footer for fields that have ACF v4 and v5 versions, such as checkbox (optional): 

 $header = $fieldDir . DIRECTORY_SEPARATOR . 'header.php';
 $footer = $fieldDir . DIRECTORY_SEPARATOR . 'footer.php';

wp_all_import_acf_field_template_header_pathsoflyy_field

Used for the header that appears before the version-specific header used above. Only needed when the default header doesn't meet your requirements.

Used for the footer that appears after the version-specific footer used above. Only needed when the default footer doesn't meet your requirements.

wp_all_import_acf_field_field

Use the $fieldData['type'] value to determine if you should override the default.
This is used to return your custom field object if you don't want to use the default class loading behavior from the hook wp_all_import_acf_field_class shown above. 

Either approach (class or field) requires that you have a class defined with the expected methods and properties, which extends from the Field class defined in the ACF Import Add-On.

Related Docs

Learn how to import Advanced Custom Fields using WP All Import.

Learn more about exporting Advanced Custom Fields with WP All Export.

Shows you how to use PHP functions or custom PHP functions during import.

The best import export plugin for WordPress & WooCommerce.

Complete, granular control of your data with an easy to use drag & drop interface.
  • 90 Day Money Back Guarantee
  • Unlimited Installs
  • Lifetime Licence
  • Fast, World-Class Support
Get Started
90 Day Money Back Guarantee

Unlimited Installs.
World-Class Support. Money Back Guarantee.

Packages
Standalone
Import
Pro Package
$199
.00
/yr
Save $494, 71% Discount
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
$693 If Purchased Individually
Buy Now
90 Day Money Back Guarantee
Import + Export Pro Package
$299
.00
/yr
Save $1087, 78% Discount
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
$1386 If Purchased Individually
Buy Now
90 Day Money Back Guarantee
WooCommerce Import Package
$169
.00
/yr
Save $29, 15% Discount
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
$198 If Purchased Individually
Buy Now
90 Day Money Back Guarantee
Lifetime License
$1299
One-Time Payment
  • Import Pro + Export Pro
  • All Current Add-Ons
  • All Future Add-Ons
  • Lifetime Support
  • Lifetime Updates
  • No Renewal Fees
Buy Now
90 Day Money Back Guarantee
Import Standalone
$99
.00
/yr
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Buy Now
90 Day Money Back Guarantee
Import + Export Standalone
$169
.00
/yr
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Buy Now
90 Day Money Back Guarantee
Export Standalone
$99
.00
/yr
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Buy Now
90 Day Money Back Guarantee
Packages
Standalone
Import
Pro Package
$16.58
per month, billed annually
Save $494/yr, 71% Discount
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
$693/yr If Purchased Individually
Buy Now
90 Day Money Back Guarantee
Import + Export Pro Package
$24.92
per month, billed annually
Save $1087/yr, 78% Discount
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
$1386/yr If Purchased Individually
Buy Now
90 Day Money Back Guarantee
WooCommerce Import Package
$14.08
per month, billed annually
Save $29/yr, 15% Discount
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
$198/yr If Purchased Individually
Buy Now
90 Day Money Back Guarantee
Lifetime License
$1399
One-Time Payment
  • Import Pro + Export Pro
  • All Current Add-Ons
  • All Future Add-Ons
  • Lifetime Support
  • Lifetime Updates
  • No Renewal Fees
Buy Now
90 Day Money Back Guarantee
Import Standalone
$8.25
per month, billed annually
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Buy Now
90 Day Money Back Guarantee
Import + Export Standalone
$14.08
per month, billed annually
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Buy Now
90 Day Money Back Guarantee
Export Standalone
$8.25
per month, billed annually
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Buy Now
90 Day Money Back Guarantee

Unlimited Installs.
World-Class Support. Money Back Guarantee.

Developer
Pro features to get your WordPress data moving
Normally $299/yr
$149
.00
/yr
Save $150
Import & Export Pro
  • Posts Types, Pages & Taxonomies
  • Custom Fields & Meta Support
  • WordPress Users Support
  • Gravity Forms Entries
  • Developer Tools
  • Pro Settings
  • See detailed list of features
    Buy Now
    90 Day Money Back Guarantee
    Professional
    Everything you need to import and export anything
    Normally $599/yr
    $299
    .00
    /yr
    Save $300
    All Features & Integrations
  • WooCommerce
  • Bulk Editing & Data Migration
  • Advanced Custom Fields
  • JetEngine
  • Meta Box
  • Manual Scheduling
  • See detailed list of features
    Buy Now
    90 Day Money Back Guarantee
    Unlimited Lifetime
    All features and integrations forever for unlimited sites
    Normally $1599
    $1299
    .00
    once
    Limited-Time Offer
    ONE-TIME PAYMENT 
  • Import Pro + Export Pro
  • All Current Features & Integrations
  • All Future Features & Integrations
  • Lifetime Updates
  • Lifetime Support
  • No Renewal Fees
  • See detailed list of features
    Buy Now
    90 Day Money Back Guarantee

    Risk Free with our Money-Back Guarantee

    We would love for you to try WP All Import. Our 90-day money-back guarantee means that if you decide our plugins don’t meet your needs, just let us know, and we’ll gladly give you a full refund, no questions asked.
    200,000+ Active Installs
    1500+ 5 Star Reviews
    Developer
    $149
    .00
    /yr
    Buy Now
    Professional
    $299
    .00
    /yr
    Buy Now
    Ultimate Lifetime
    $1299
    Buy Now
    Unlimited Lifetime Package Features
    included in only in the Ultimate Lifetime Package
    One-Time Payment. No Renewal.
    All Future Add-Ons
    Developer Package Features
    included in all packages
    Untilimited Site Activations
    World-Class Support
    Import & Export Custom Post Types, Pages & Taxonomies
    Import & Export Custom Fields & Meta
    Download Import File from URL & FTP
    Export to CSV, XLSX, and XML
    Import & Export Filters
    Import & Export WordPress Users
    Import & Export Gravity Forms Entries
    Delete Missing Records on Import
    Run PHP Functions on Imports & Exports
    Choose Which Data to Update
    WP_Query Exports
    Secure Client Mode for Exports
    Zapier Integration for Exports
    Professional Package Features
    everything the Developer package, plus:
    Import & Export WooCommerce Products
    Import & Export WooCommerce Product Galleries
    Import & Export WooCommerce Orders
    Import & Export WooCommerce Customers
    Import & Export WooCommerce Reviews & Coupons
    Sync WooCommerce Stock & Prices
    Import & Export ACF Fields
    Import & Export JetEngine Fields
    Import & Export Meta Box Fields
    Export to Google Merchant Center
    Migrate Data Between Sites
    Bulk Edit with Export, Edit, Import
    Manual Scheduling for Imports & Exports

    Have any questions? 

    These are some of the most frequent questions we get about how to get data imported to or exported from WordPress

    Can I use any file type to import my data?

    Absolutely. It doesn't matter how big your CSV file is or what your column names are. Just use our Drag and Drop interface to map incoming data elements to their target fields, and you'll be done in minutes.

    Can I import Excel or Google Sheets to WordPress?

    Yes. Importing any spreadsheet is straightforward. Need to import Google Sheets to WordPress? Just copy and paste its URL. Need to import into WordPress from Excel? Same thing!

    How does my WordPress import data need to be organized?

    Our plugin is extremely flexible, so you probably won't have to make any changes to your data. You can try your WordPress import right now, and if you have any issues, we'll be glad to help you out.

    What will my WordPress export file look like?

    Unlike other solutions, our plugin gives you complete control over your WordPress export, including how it's formatted. You can modify fields, merge them together, and even create completely custom fields using embedded PHP.

    How do I export WordPress data to CSV?

    To export data to a CSV file, you don't have to do anything at all, as CSV is our default export format. If you want to export to other file formats, just change the export type in the Drag & Drop screen.

    Can I export WooCommerce products?

    Yes. Our software is completely integrated with WooCommerce. It provides full support to export WooCommerce customers, orders, products, variations, attributes, subscriptions, and reviews.
    cross