---
title: "Import Only Some Posts from a WordPress XML (WXR) Export File"
url: "https://wpimportexport.com/import-selected-posts-wordpress-xml-export/"
description: "Import only some posts from a WordPress export (WXR) file: one category, published posts only, or posts after a date, with categories and tags."
type: post
published: 2026-11-25T09:00:00+00:00
modified: 2026-11-26T14:59:06+00:00
categories: ["Import Guides", "Tutorials"]
tags: ["CSV import", "Import Export by RockStarLab"]
docs_topics: ["Import guides", "Sync and migration"]
---

# Import Only Some Posts from a WordPress XML (WXR) Export File

A WordPress export file (Tools → Export) holds everything: all posts, pages, drafts and their categories. When you only want part of it on another site, for example the recipes of an old food and travel blog, the standard WordPress importer brings in all of it, and you delete the rest by hand. With **Import Export by RockStarLab**, you set conditions and only the matching posts are imported.

**Free:** everything here is in the free plugin. Use version 2.2.1 or newer: 2.2.0 adds the row filter and 2.2.1 keeps the tags of WordPress export files apart from the categories.

## The export file

Our file is the export of a food and travel blog: 12 items, 10 posts and 2 pages. Six posts are in the Recipes category (one of them also in Travel), one recipe is still a draft, and the others are travel stories and news. We want only the published recipes, with their categories and tags.

In such a file every post is an `<item>`. The plugin reads each item as a row and its fields as columns: `title`, `content:encoded`, `wp:post_date`, `wp:status`, `wp:post_type`, `category` (the categories) and `tag` (the tags).

## Step 1: Upload and Auto Map

Open **Import Export → Import**, choose **Posts**, upload the XML file and continue to the mapping step. Click **Auto Map**. The columns of WordPress export files are recognized: title, content, excerpt, date, slug, status, author, categories and tags:

![Mapped fields of a WordPress export file: title, category, tag, dc:creator, content:encoded, excerpt:encoded, wp:post_date, wp:post_name](https://wpimportexport.com/wp-content/uploads/2026/11/01-mapping-10.webp)

_Auto Map recognizes the columns of a WordPress export file._

## Step 2: Filter the rows

In step 5, **Import Options**, tick **Filter Rows** and add three conditions:

![Filter Rows with category contains Recipes, wp:status equals publish and wp:post_type equals post](https://wpimportexport.com/wp-content/uploads/2026/11/02-row-filter-1.webp)

_Only published recipe posts._

- `category` **contains** `Recipes`: the post is in the Recipes category, alone or with others.
- `wp:status` **equals** `publish`: leaves out drafts, pending and private posts.
- `wp:post_type` **equals** `post`: leaves out pages, menu items and attachments, which the same file can contain.

**Rows must match: all conditions** means a row needs all three. Text comparisons ignore letter case.

## Step 3: Import

Click **Start Import**. Our import created 6 posts in a second:

![Import Completed Successfully with 6 created posts](https://wpimportexport.com/wp-content/uploads/2026/11/03-result-5.webp)

_Six of the twelve items were imported._

The job log says _6 rows did not match the row filter and were not imported_: the travel and news posts, the draft recipe and the two pages.

## The result

The six recipes are on the new site with their original dates, categories and tags. Market Day in Lyon keeps both its categories, Recipes and Travel:

![Posts list with six recipe posts, their categories, tags and original dates](https://wpimportexport.com/wp-content/uploads/2026/11/04-imported-posts.webp)

_The recipes with their categories, tags and dates._

## More filters

- **Posts after a date:** `wp:post_date` **greater than / after** `2023-01-01`.
- **One author:** `dc:creator` **equals** the author’s login.
- **Several categories:** set **Rows must match** to **any condition** and add one `category` **contains** condition per category.
- **Leave out a category:** `category` **does not contain** `News`.
- **Tags:** the `tag` column works the same way, for example `tag` **contains** `baking`.

**Contains** also matches parts of a name: `Recipes` matches a category called Vegan Recipes too. Use **is one of** with the exact names when that matters.

The import adds posts to the site. [Back up the site](https://wpimportexport.com/how-to-create-a-wordpress-website-backup-and-restore-it/) first, or ask your AI agent to start the backup.

## With an AI agent

An AI agent connected to the site through the WordPress MCP Adapter (see [connecting Claude Code to WordPress](https://wpimportexport.com/connect-claude-code-to-wordpress-mcp/)) can do the same:

Without the plugin, WordPress 7.1.5 gives a connected agent only three read-only abilities for site, user and environment information. The exports, imports and syncs in the requests below are abilities of Import Export by RockStarLab.

```
With Import Export by RockStarLab, import only the published recipe posts from old-blog.xml, with their categories and tags.
```

In our run, the agent loaded the file with `rsl-ie/upload-from-url`, read the columns from the answer, and called `rsl-ie/import-start` with the mapping and `options.row_filters`: `category` contains Recipes, `wp:status` equals publish and `wp:post_type` equals post. Job 99 finished with 6 posts, and the log said that 6 rows did not match.

## FAQ

### Are images in the posts imported too?

Images in the post content are downloaded into the Media Library when **Automatically Import Media Files** is on in step 5 (the default) and the old site is still online. The file itself has only links.

### Can I import the comments of these posts?

Not in the same step. The comment columns of the file (wp:comment/…) are not mapped to post fields. Import comments separately, or move the posts and comments between two live sites with Content Sync.

### What if I run the import twice?

Set **Check for Existing Items by Field** to the slug (post_name) and **If Match Found** to Skip or Update, so the posts are not created twice.

### Does the filter work with CSV and Excel files?

Yes. The Filter Rows option works with every file format; the columns are the column headers of the file.

## Related Guides

- [Import WordPress and WordPress.com Export Files (What’s New in 2.1.52)](https://wpimportexport.com/wordpress-export-xml-import-export-by-rockstarlab-2-1-52/)
- [Move WordPress Posts to a New Site and Keep Dates, Authors and Slugs](https://wpimportexport.com/move-wordpress-posts-keep-dates-authors-slugs/)
- [Admin Colors, Row Filter and Day-First Dates (What’s New in 2.2.0)](https://wpimportexport.com/admin-colors-row-filter-import-export-by-rockstarlab-2-2-0/)

Get the free plugin on [WordPress.org](https://wordpress.org/plugins/import-export-by-rockstarlab/).
