Back to blog
5 min read Import Guides

Build a Directory in WordPress from a CSV File

A directory on a WordPress site is a list of entries that all have the same details: shops with an address and phone number, members with a city and a website, listings with a region. The data usually starts in a spreadsheet. With Import Export by RockStarLab you turn that spreadsheet into directory entries in one import: each row becomes a post in its own post type, each column a field. The example is a “Where to buy” directory of six cafés and shops that sell a coffee roastery’s beans.

PRO: importing into a custom post type needs Import Export PRO. Free: the same import into posts or pages, with ACF fields and categories.

Short Answer

  1. Create a post type for the entries, a taxonomy for grouping them, and an ACF field group with the details (all three can be made in ACF).
  2. Make a CSV with one row per entry: title, description, status, region and one column per field.
  3. In Import, choose Custom Post Types, upload the file, choose the post type, click Auto Map and map the region column to the taxonomy.

Set up the post type and fields

We used ACF to create everything the directory needs:

  • a post type Stockists (stockist), public, with an archive page;
  • a taxonomy Regions (stockist_region) for the post type;
  • a field group Stockist details shown on Stockists, with City, Address and Phone (text) and Website (URL).

Any plugin or code that registers a post type works the same way. The field group must exist before the import, so its fields show up in the mapping.

Prepare the CSV

One row per entry. Use clear headers: the import matches them to fields by name.

post_title,post_content,post_status,region,city,address,phone,website
Café Lumen,Espresso bar serving our House Blend and a rotating single origin.,publish,North,Leeds,"14 Briggate, Leeds LS1 6HD",+44 113 496 0101,https://cafe-lumen.example.com
The Book Nook,Bookshop café with filter coffee and retail bags.,publish,North,York,"3 Stonegate, York YO1 8AW",+44 1904 496 202,https://booknook.example.com
Hotel Aurora,"Breakfast and lobby bar, beans available at reception.",publish,South,Brighton,"88 Marine Parade, Brighton BN2 1AB",+44 1273 496 303,https://hotel-aurora.example.com
Green Leaf Office,Office kitchen supplied weekly; not open to the public.,publish,South,London,"21 Old Street, London EC1V 9HL",+44 20 7946 0404,
Mountain Bakery,Bakery with pour-over and our decaf.,publish,Scotland,Edinburgh,"5 Grassmarket, Edinburgh EH1 2HS",+44 131 496 0505,https://mountainbakery.example.com
Harbour Deli,Deli counter selling 250 g bags of every blend.,publish,Scotland,Aberdeen,"40 Shore Brae, Aberdeen AB11 5BD",+44 1224 496 606,https://harbourdeli.example.com

The post_status column set to publish makes the entries live right away; without it they are created as drafts. Region names that don’t exist yet are created as terms during the import. An empty cell, like Green Leaf Office’s website, leaves the field empty.

Import into the post type

In Import, choose Custom Post Types, upload the file and go to the mapping step. Choose Stockists in Choose post type: its ACF fields appear in the ACF Fields group. Click Auto Map; title, content, status and the four ACF fields are matched.

For the region, click + Add next to Taxonomy, enter stockist_region, choose Term Name as the format and drag the region column onto the new field:

Import mapping for the post type Stockists: post_title, post_content and post_status to the standard fields, region to the taxonomy stockist_region by name, city, address, phone and website to the ACF fields; 8 of 8 fields mapped
Standard fields, the Region taxonomy and the four ACF fields, all mapped from one file.

On the options step, check existing items by Title, update matches and create the rest:

Import options: Check for Existing Items by Field Title, If Match Found Update, If No Match Found Create, Batch Size 50
Match by title, so a corrected file updates listings instead of adding them twice.

The import created six published stockists in about a second, each with its city, address, phone, website and region: two in North, two in South and two in Scotland. Click Save as Template on the mapping step to reuse the mapping for the next version of the spreadsheet.

Show the directory on the site

The entries are now in WordPress, with an archive at /stockist/ and a page per entry. How the fields look on those pages is up to your theme: a block theme template, a page builder, or ACF’s own blocks and shortcodes. That part is design work, not import work.

Before you import

Try the file with two or three rows first, and back up the site before importing hundreds of entries.

With an AI agent

An AI agent connected through the WordPress MCP Adapter (see connecting Claude Code to WordPress) can look entries up after the import:

Which of our stockists are in Edinburgh, and what is their phone number?

In our run, the agent called rsl-ie-pro/export-preview for the post type stockist with a filter on acf_city equals Edinburgh. It returned Mountain Bakery with the phone number +44 131 496 0505. Asked for the count of published stockists, it called rsl-ie-pro/export-count and answered 6.

FAQ

Can I add images to the entries?

Yes, add a column with an image URL and map it to Featured Image URL; the image is downloaded during the import.

How do I update the directory later?

Import the corrected file again with Check for Existing Items by Field set to Title and If Match Found set to Update.

Do I need ACF?

No. Without ACF, map the columns to plain custom fields with Custom Field + Add. ACF gives you the edit screen for the fields.

Can I export the directory back to a spreadsheet?

Yes, see exporting a custom post type with its ACF fields to Excel.

Get the free plugin on WordPress.org.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE