I have a member section built using the http://www.advancedcustomfields.com plugin. There are 300 members that each have the following data:

  • Company name
  • Specialism (check boxes)
  • Web address
  • Telephone number
  • Region
  • Address
  • Email

What's the best way to import into the database? How should I setup a csv file? I haven't added the 300 member pages, I just have these custom fields setup using the plugin.

  • Close-voted as off-topic. This is either a PHP/SQL question rather than a WordPress question, or else it is a Plugin-specific question, and thus too localized. Feb 24, 2012 at 15:12
  • 5
    @ChipBennett ??? That's ridiculous! Exactly what forum am I supposed to ask this on then? If asked on the normal SO forum they would just send me here! There's plenty of plugin specific questions on here. Your far too agressive with modding this forum as this isn't the first time!
    – Rob
    Feb 24, 2012 at 15:27
  • Fair enough. So: what is the WordPress specific part of this question? You're asking about importing an arbitrary data set into an arbitrary database, and doing so via a CSV file. None of that has anything to do with WordPress. (p.s. I'm not a mod.) Feb 24, 2012 at 15:32
  • 6
    @ChipBennett It has EVERYTHING to do with Wordpress since I need it all in a format that's readable by the cms. So your saying the hundreds of questions on here to do with plugins are too localized and database questions aren't related. My related questions sidebar is filled with similar questions yet according to your "rules" I can't post it here! Exactly where do I post this then?
    – Rob
    Feb 24, 2012 at 15:46
  • What do you mean by "readable by the CMS"? Are you saying that you're trying to do a raw SQL import to update the wp_post_meta DB table entries for 300 existing posts? Feb 24, 2012 at 15:49

1 Answer 1


Sounds like you have successfully gotten all 300 Pages imported based on the comments. (Regardless of how you did it, either by using the WordPress import plugin or by using some MySQL tool like phpMyAdmin or Sequel Pro or whatever)... You have 300 pages in the wp_posts table. Let's start from here then...

The ACF plugin uses the wp_postmeta table to populate and link custom fields to specific posts/pages. (A very thoughtful design, by the way)!

That table consists of 4 columns:

meta_id - A unique auto incremented primary key

post_id - A foreign key that links to the post or page

meta_key - In this case the name (key) of the custom field

meta_value - The actual text or content for that custom field

So if you've created a CSV file, you would basically create your data to fit into that model. If you have 300 records sitting in your wp_posts table, they should all have a unique ID (in the ID column). That's the ID that you'll put into the wp_postmeta.post_id column.

Now, if you inspect the Field Group you've created, you'll see all of the Field Names (which are the wp_postmeta.meta_key values. Here's a screenshot of an example in a project I'm working on right now:

ACF Example

I've named mine header_content and left_sidebar_content for example. Finally, throw the values of each of your fields into the wp_postmeta.meta_value field.

All of that is a high level walkthrough of the schema and structure of the data. The actual implementation of how you import the data is up to you. (Whether you use a CSV file, XML, or actually write some SQL to insert the data).

Hope that helps get you on the right track!

  • can't agree the approach used by ACF is a good design or not, as the data is not easy to be searched or indexed...
    – Raptor
    Jun 22, 2015 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.