Import Post Exists

By 2danlv

0+ active installationsVersion 1.1.1

Import Post Exists allows you to safely export and import WordPress content between environments while updating existing posts instead of creating dup …

Description

Features:

  • Update existing posts
  • Create new posts
  • Hierarchical page sync
  • ACF support
  • Polylang support
  • Taxonomy sync
  • Featured image sync
  • Auto backup before import or restore
  • Backup tab: list, download, restore and delete backup files
  • Option to import publish date (post_date) from JSON
  • Relink images inside post content to existing Media Library attachments (auto width/height/class, keeps relative src for staging-to-production imports)

Installation

  1. Upload plugin
  2. Activate plugin
  3. Open Tools > Import Post Exists

Screenshots

Changelog

1.1.1

  • Security: Import never creates PHP objects from serialized post meta in the JSON. Values containing objects or broken serialized data are skipped
  • Security: Preview and Export tables escape every value coming from the JSON file or the database before displaying it
  • Security: Export/Import only process the post types listed on the Export screen (public post types except attachment, plus Contact Form 7). Other post types (e.g. Flamingo messages, wp_template) are rejected on the server, also when post IDs are sent directly
  • Security: Import only updates a target post of the same post type, and post_status must be a registered public status (publish, draft, pending, private, future); any other value becomes draft
  • Security: Backup file names now contain a random token, the backup folder .htaccess supports both Apache 2.4 and 2.2, and download/delete only accept .json files
  • Export/Import: WordPress internal meta (edit_lock, _wp_old_slug, _oembed*, trash/pingback flags…), media/menu meta (wp_attached_file, _wp_attachment*, menu_item*) and sensitive keys (password, token, secret, api_key…) are never exported or imported. Add more keys with the “impoex_export_excluded_meta_keys” filter
  • Import: the Review table starts with a summary counting the posts that need attention (errors, missing media, posts in Trash on the source site, posts matching a post in Trash on this site), each with a “Show only these” filter
  • Backup: fix “Restore” failing with “Not support this format JSON” for posts with non-Latin slugs (e.g. Japanese): the percent-encoded slug in the file name was stripped, so the file was not found. New backup files are named with the post type (e.g. 20261119-094657-tomys_menu-xxxx-import.json); existing files can be restored, downloaded and deleted again. Restore now shows the real reason when a backup file cannot be loaded
  • Import: show a warning after import listing the meta keys that were skipped, with details in Support > Error messages
  • Export: fix ACF fields missing from the JSON when a post has the value but not the ACF reference meta (“_field_name”), e.g. posts created with wp_insert_post( meta_input ) or update_post_meta(). Fields of the ACF field groups assigned to the post are now exported and listed in the “Post Meta” checkbox list
  • Export: new “Post Meta” checkbox list (post meta and top-level ACF fields marked “(ACF)”) to choose which fields are exported. Backups still include every field
  • Import: ACF fields are now listed in the “Post Meta” checkbox list and only checked fields are imported
  • Import: fix all meta being imported when every meta checkbox was unchecked
  • Export: keep empty meta values, so a field cleared on the source site is also cleared on the destination
  • Export/Import: meta values that store a term ID can be exported as a term slug and mapped back to the destination term ID. Declare these meta keys with the “impoex_term_id_meta_keys” filter
  • Export: the post count next to each post type now includes Trash (a post type with only trashed posts is listed too), with a note that Status “All” does not include Trash
  • Export: new “Trash” status filter. Trashed posts are exported with their original slug and path (without the “__trashed” suffix), so they still match the live post on the destination site
  • Import: new “Import trashed posts” option (unchecked by default, shown only when the JSON contains trashed posts). When checked, the matching destination post is first updated from the JSON like a normal import (backup included, current status kept), then moved to Trash with wp_trash_post(), so it can be restored to its previous status. No new post is created for trashed posts. When unchecked, trashed posts are shown as SKIP in Preview
  • Import: new “Restore matching posts from Trash” option (unchecked by default, shown only when a JSON post matches a post that is in Trash on this site). When checked, that post is restored (Trash → Draft with its original slug, same post ID, backup first), updated from the JSON, then gets the status from the JSON. Unchecked: a new post is created and the trashed post stays in Trash, as before
  • Import: fix the backup file name missing the “-import” suffix when the request did not send it
  • Export: fix the Status filter always jumping back to “All” after selecting another status, so Load Data never filtered by status
  • UI: trashed posts are highlighted in red: the Status cell in the Export list, and in the Import preview the whole row of a trashed JSON post (with a “Status: Trash” label) and the Target cell of a RESTORE row
  • UI: Japanese (percent-encoded) URLs and slugs are shown decoded in the Export list, Preview table and Permalink column. Fix the permalink link in the Export list being double-encoded
  • Uninstall: remove the whole backup folder (including .htaccess and index.php), on every site of a multisite network

1.1

  • Import: batches are now limited by size (about 1MB per request) as well as count (max 10 posts), so large posts no longer make the request too big for hosts that close the connection on large requests
  • Import: post data is sent base64-encoded so server firewalls (WAF) no longer block the request because of HTML/CSS in post content. The server still accepts plain JSON requests
  • Import tab: show “Maximum upload file size” (the lower of upload_max_filesize and post_max_size) below the JSON drop zone
  • Preview: check the file size before uploading and show a clear message when it exceeds the server upload limit, instead of “Not support this format JSON”
  • Preview/Import: show the real error reason (server message, 400 post_max_size, 403 firewall block, 413, timeout, PHP error output) instead of a generic message
  • Support tab: new “Error messages” table (cause and how to fix for each message) and the current server limits (upload_max_filesize, post_max_size, max_execution_time, memory_limit)

1.0.9

  • Import: new options “Import title” and “Import content” (checked by default). Uncheck to keep the title/content of existing posts unchanged when updating; new posts always get title and content from JSON
  • Import/Restore: fix backslashes (“\”) being removed from post meta, ACF values and term name/description (e.g. “C:\Users\file.pdf” was saved as “C:Usersfile.pdf”). WordPress unslashes these values on save, so they are now slashed first
  • Import: large files are imported in batches of 10 posts per request (with a progress counter) to avoid timeouts. Parents are still imported before children across the whole file, and Polylang translations in different batches are linked after the last batch. If a batch fails, the import stops and reports how many posts were imported
  • Import/Restore: fix nested ACF fields inside repeater/group (file, gallery, sub repeater, sub group) being saved as empty values
  • Import: fix duplicate parent placeholders for nested pages — missing parents are now created level by level at their real position (e.g. “a” then “a/b”), so sibling pages share the same placeholder
  • Import: fix Gutenberg image blocks showing “Block contains unexpected or invalid content” after import — block content now only updates the image block “id” and wp-image-{id} class to the destination attachment (no extra width/height/size-full); classic content keeps the previous behavior
  • Import: create missing taxonomy terms, including parent terms and the Polylang language from JSON. Export now writes each term as {slug, name, description, language, parent}; older JSON with slug-only terms still imports (missing terms are skipped as before)
  • Preview: new “New Terms” column listing the terms that will be created
  • Export: skip ACF relationship and post_object fields (also inside repeater/group). They store source-site post IDs that point to wrong posts on the destination, so import no longer overwrites them — values set manually on the destination are kept
  • Import/Preview: items whose post type does not exist on the destination site are marked as ERROR in Preview and skipped on import, to avoid orphan data
  • Backup: add checkboxes and “Delete selected” to delete multiple backup files at once
  • Import: post slugs now follow WordPress defaults (a duplicate slug gets “-2”). With the Polylang Slug plugin active, the same slug is allowed across languages (checked against the JSON language, since new posts have no language yet when WordPress checks the slug). Previously the JSON slug was always forced, which without Polylang Slug broke front-end URLs and was renamed to “-2” on the next save in wp-admin
  • Export: add “source_url” (site home URL) to each exported item
  • Export: omit empty “post_excerpt”, “taxonomies”, “parent”, “acf” and “meta” fields for a smaller JSON (import treats missing fields as empty, same as before)
  • Import: when “source_url” differs from the destination site, replace the source site URL with the destination URL in post content, excerpt, ACF values and post meta (serialized meta is unserialized first, so string lengths stay valid) (http://, https:// and // forms; exact domain match only, e.g. “a.com” never touches “a.com.vn”). JSON files without “source_url” are imported as before
  • Import: absolute image src pointing to another site’s uploads (e.g. https://staging.example/wp-content/uploads/…) is now rewritten to the destination uploads URL when the file exists in the destination Media Library; relative src (/wp-content/uploads/…) and missing images are left unchanged
  • Export: fix PHP warning when a post’s parent no longer exists (exported as a post without parent)
  • Export: parent sync_key now uses the parent’s own Polylang language instead of the child’s
  • Export: fix “who” argument deprecated notice (WP 5.9+) in the author filter
  • Export: author filter now only lists users who have posts in the exportable post types
  • Preview: translate remaining Vietnamese UI messages (missing media, duplicate slug warning) to English
  • Code: remove unused “impoex_restore_backup” AJAX handler (the Restore button already runs through the import flow)

1.0.8

  • Export/Import: support Contact Form 7 forms (form content + Mail, Mail (2), Messages, Additional Settings)
  • Import: add “Create new posts from JSON” option to always insert new posts instead of updating/overwriting existing ones
  • Preview: show simulated “-2” slug and skip target info when “Create new posts” is checked, to avoid confusion with overwrite
  • Export: post type dropdown now hides post types with 0 posts, and excludes trash/auto-draft from the displayed count
  • UI: replace emoji icons with Dashicons to avoid broken icons when the emoji CDN is unreachable
  • Export: omit empty “language” field when Polylang is not active on the source site
  • Import: when multiple posts share the same slug across Polylang languages and JSON has no language info, use post_title as a tie-breaker before falling back to the lowest post ID
  • Preview: warn when a JSON item matches more than one post on the destination (same slug/post_type, e.g. duplicate Polylang translations), listing all matches and which one will be updated

1.0.7

  • Preview: scan JSON for missing media (featured image, ACF image/file/gallery/repeater/group) before import, show a “Missing Media” column listing affected fields/paths
  • Preview: show loading overlay while scanning
  • Import/Restore: featured image now fully follows JSON — removes the destination’s current featured image when the JSON path doesn’t match any existing attachment, instead of silently keeping the old one
  • Import/Restore: ACF image/file fields now always overwrite with JSON data (keep the raw path as a placeholder when unresolved) instead of being skipped
  • Restore: fix ACF group fields (including nested image/repeater) not being restored from backup
  • Restore: fix ACF image/file fields not being cleared when the backup JSON has no file
  • Fix: attachment lookup by file path now orders results deterministically and excludes trashed/non-attachment posts

1.0.6

  • Import: auto-detect <img> tags in post content that match existing Media Library attachments on the destination site
  • Import: auto-fill width/height and wp-image-{id}/size-full class on matched images, matching WordPress editor output
  • Import: image src is left unchanged (exactly as in the JSON) to support staging-to-production imports across different domains/paths

1.0.4

  • Export: add post_date (publish date) to exported JSON
  • Import: add “Import publish date” option to apply post_date from JSON when creating/updating posts

1.0.3

  • Add Backup tab: list, download and restore backup files
  • Auto backup post before import or restore
  • Add check-all for import table
  • Validate JSON format on file select
  • Fix export checkbox: export selected posts only
  • Fix import metabox
  • Import with ajax

1.0.2

  • Fix import page template

1.0.1

  • Show Permalink to Page

1.0.0

  • Initial release