WP All Import is a WordPress plugin that lets you import all types of WordPress and WooCommerce data. It now has a Meta Box Import Add-On that lets you import data into Meta Box custom fields, as well.
In this article, we’ll show you how to perform a basic import of data into Meta Box custom fields.
Get the Meta Box Import Add-On
If you’re an existing WP All Import customer, you can obtain the Meta Box Import Add-On through your customer portal. If you’re new to WP All Import, please visit this page.
Create a Meta Box Import with WP All Import
WP All Import lets you import data into any WordPress and WooCommerce post type using the same basic process:
Step 1: Create a New Import
Go to All Import › New Import and load your import data. You have several options to do this:
- Upload a local file;
- Download a file from a URL or FTP/SFTP site;
- Use an existing file that you’ve already used with WP All Import;
In this example, we’ve uploaded a local file:
You must then select the target post type for your import, i.e., the one with the Meta Box custom fields that you wish to populate. In the above image, we’ve selected Properties.
As part of selecting the target post type, you must also indicate whether you’re importing New Items or Existing Items (i.e., properties, in this case). This can affect some of the options presented to you during the import process. If you’re importing data into properties that are already on your site, choose Existing Items. Otherwise, choose New Items.
When you’ve completed all of this, click Continue to Step 2.
Step 2: Review the Import Data
The Review Import File screen lets you verify whether WP All Import has correctly interpreted your import file:
If the answer is “no”, you’ll need to fix your import file and try again. If the answer is “yes”, but you don’t like how some of the incoming data is formatted, don’t worry about it. WP All Import has plenty of features to help you modify data during the import process.
As long as the answer isn’t “no”, click the Continue to Step 3 button.
Step 3: Map Incoming Data Elements to the Meta Box Custom Fields
The main screen in the import process is the Drag & Drop screen, which allows you to map incoming data elements to their target WordPress fields using drag and drop:
To import data into the Meta Box custom fields, expand the Meta Box Add-On section at the bottom of the preceding image and then perform the same mapping process there:
In this example, note that, in some cases, you are mapping multiple incoming data elements into the same field (e.g., Map Address, as one example). This is just one of the capabilities you can use to shape incoming data to fit your needs. We’ll address others in the Advanced Features section below.
Once you’ve finished mapping all of your data, click the Continue to Step 4 button at the bottom of the screen (not shown).
Step 4: Configure the Import Settings
The Import Settings screen lets you specify a unique identifier, which allows WP All Import to differentiate between records so that it can perform updates and avoid creating duplicates.
You can enter this manually if you wish, but a far more convenient option is to simply click the Auto-detect button and let WP All Import generate the identifier for you.
Midway down the screen, several options allow you to dictate whether the import should create new records (i.e., properties, in this example), update existing records, or remove existing records if they’re not present in the import file.
If you choose to update existing records, you can then choose the specific fields to update (not shown).
Near the bottom of the screen, you can schedule your import and configure several other advanced settings.
For now, just click the Continue button.
Step 5: Complete the Import and Verify That it Worked
The last screen in the process is the Confirm & Run screen. Here, you can review the Import Summary, which is basically a description of the actions that WP All Import is about to take. If anything looks wrong, you can click the or go back to Step 4 link at the bottom to return to earlier screens and make corrections.
Assuming that everything is okay, click Confirm & Run Import. After a short period, an Import Complete! message will appear on the screen, along with a summary and a log of what took place.
Your last action should then be to check your data through the WordPress interface to make sure that everything appears as expected.
And that’s it — that’s how you perform a basic import of data into Meta Box custom fields!
Import Meta Box Custom Fields — Advanced Features
How to Modify Incoming Data During the Import
In Step 3 of this tutorial, we showed multiple incoming data elements being mapped to the same WordPress field in combination with typed values such as commas and spaces.
You can also use standard PHP functions to modify incoming data in other ways. For example, you can use the PHP str_replace()
function to remove all commas from an incoming data element:
With scores of standard PHP functions available like this, you can do almost anything with your incoming data.
If that’s not good enough, WP All Import also allows you to create custom PHP functions directly through its interface at the bottom of the Drag & Drop screen. In this example, we’ve created a function to round a price value:
You can then call that custom function the same way that you call a standard PHP function:
Note, this example is not from our tutorial, but the principle is the same regardless of what you’re importing.
What does this kind of data manipulation do for you? It gives you the flexibility to handle pretty much any import file, regardless of its column layout, formatting issues, etc.
For more information on these capabilities, see Calling PHP Functions In Your Import Configuration.
How to Filter Your Import Data
You can filter your import data by expanding the Add Filtering Options section at the bottom of the Review Import File screen.
A filter consists of one or more filter rules. Each filter rule requires an Element, a Rule, and a Value.
Here, we’ve created two filter rules:
The first rule specifies that the Image_URL
incoming data element cannot be empty.
The second rule specifies that the Sale_Price
data element must be greater than 50.
Note, also, that the two rules are joined by an AND
condition, which means that both conditions must be true before a record will be imported.
You can even nest filter rules in groups by indenting them, which is the equivalent of using parentheses.
See this instruction to learn more about filtering import data with XPath.
How to Schedule Your Import
As mentioned earlier, you can schedule your imports by expanding the Scheduling Options section of the Import Settings screen. You have several options when you do this. One option is to use Automatic Scheduling, which lets you schedule your import directly through the interface. In this example, we are scheduling the import to run every Tuesday at 1:00 a.m. New York time:
This service costs $9 per month and will also verify that each scheduled import is completed successfully.
Manual Scheduling lets you schedule your imports by manually creating cron jobs on your server. This is obviously less convenient but has the advantage of being free.
For more information about recurring imports, see this post.