How to Overwrite Existing Pages and Posts with the WordPress Importer
Content
A common challenge users face with the WordPress Importer plugin is its default behavior of skipping content it believes already exists. This often leads to frustration when trying to update a live site from a development environment or when re-importing content after making changes. Based on community discussions, this article explains why this happens and outlines the most common solutions.
The Problem: "Page/Post Already Exists"
When you run an import, the WordPress Importer checks for existing content by comparing the post's post_title and the guid (Global Unique Identifier) field from the import file against what's already in your WordPress database. If it finds a match, it skips importing that item to prevent creating duplicates. This is the plugin's intended, default behavior. Users report this is a consistent issue when trying to push changes from a staging/development site back to a live production site.
Why This Happens
The core issue is that the standard WordPress Importer plugin does not have a built-in, user-facing option to force an overwrite of existing content. It is designed primarily for migration, not for synchronization. Therefore, it will not update a page's content, meta data, or modified date; it will simply skip it. Some users have also noted that after a successful import, the post_modified date is set to the post_date, which can further complicate tracking changes.
Common Solutions and Workarounds
1. Delete Content Before Importing
The most straightforward method is to manually delete the specific pages or posts you wish to update on the destination site before running the import. This ensures there is no existing content for the importer to find, so it will create everything anew. Warning: Always ensure you have a full backup before mass-deleting content. This method will also result in new post IDs, which may break internal links or relationships.
2. Use a Dedicated Plugin for Synchronization
Since the WordPress Importer is not built for two-way synchronization, many community members recommend using a more specialized plugin or service designed for pushing changes from a staging site to a live site. These tools are specifically engineered to handle overwrites and database synchronization safely.
3. Modify the Import File (For Advanced Users)
If you are comfortable working with XML, you can edit the export file before importing it. You could theoretically change the guid for the items you want to overwrite, which would trick the importer into thinking it's new content. However, this is not recommended as it can have unintended consequences on your database integrity.
4. Post Type Switcher for Converting Content
For a related issue—needing to import pages as posts or vice versa—the community often suggests using the Post Type Switcher plugin. You would first import the content normally (letting it create the wrong post type) and then use that plugin to bulk-change the post type afterward. The standard importer itself cannot change post types during import.
Important Limitations to Consider
- User IDs: The importer does not preserve original user IDs upon import, which can break custom tables that reference them. It assigns new IDs.
- Category Slugs: Importing categories with the same name but different slugs can also cause conflicts, as the importer may see them as duplicates.
- Not for Syncing: The plugin is best used for one-time migrations. For ongoing development workflows, a different synchronization strategy is highly recommended.
In summary, while the WordPress Importer is an excellent tool for migrations, its lack of a force-overwrite feature is a known limitation. The solutions above, from simple deletion to using more robust tools, are the most common ways the community works around this behavior.
Related Support Threads Support
-
Forcefully Importing (i.e., Overwriting) Pageshttps://wordpress.org/support/topic/forcefully-importing-pages/
-
Import Pages as Postshttps://wordpress.org/support/topic/import-pages-as-posts/
-
Does page ID get imported or is new one created?https://wordpress.org/support/topic/does-page-id-get-imported-or-is-new-one-created/
-
Overwrite Page on importhttps://wordpress.org/support/topic/overwrite-page-on-import/
-
What if the content importing is duplicate with existing contenthttps://wordpress.org/support/topic/what-if-the-content-importing-is-duplicate-with-existing-content/
-
post_modified == post_datehttps://wordpress.org/support/topic/post_modified-post_date/
-
REPLACING PAGEShttps://wordpress.org/support/topic/replacing-pages/
-
importing posts/pageshttps://wordpress.org/support/topic/importing-postspages/
-
importing Posts failshttps://wordpress.org/support/topic/importing-posts-fails/
-
User_ids were all changedhttps://wordpress.org/support/topic/user_ids-were-all-changed/
-
Importing issueshttps://wordpress.org/support/topic/importing-issues-3/
-
Import Categories with same name but different slughttps://wordpress.org/support/topic/import-categories-with-same-name-but-different-slug/
-
[Plugin: WordPress Importer] existing posts skipped, not updatedhttps://wordpress.org/support/topic/plugin-wordpress-importer-existing-posts-skipped-not-updated/