WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#23465 closed defect (bug) (wontfix)

WXR importer does not import posts if a post with the same title is in the trash

Reported by: mark-k Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: Import Keywords:
Focuses: Cc:

Description

  1. export a WXR file with some/all posts
  2. send posts to trash
  3. import the file generated at step 1.
  4. for each post there is a message that the post already exist

If something is in the trash it should be handled as if it doesn't exist.

Change History (6)

#1 @Mamaduka
7 years ago

  • Cc georgemamadashvili@… added

#3 follow-up: @c3mdigital
7 years ago

  • Resolution set to wontfix
  • Status changed from new to closed
  • Version set to 2.0

This is intended behavior. post_exists() is the function used by the importer to determine if the post exists before importing it. The function compares post_title, post_content and post_date and does not distinguish between revisions or statuses to prevent importing the same post multiple times. If you move a previously imported post into the trash it is assumed that you do not want that post so it is not imported again.

#4 in reply to: ↑ 3 ; follow-up: @mark-k
7 years ago

Replying to c3mdigital:

.... If you move a previously imported post into the trash it is assumed that you do not want that post .....

Exactly, if a post is in the trash it means that I don't want it and it should be ignored as if it is not in the DB any longer. In any case you the reproduction process described is not the only way to get into this situation, just the easiest one to describe. The importer doesn't know if a post in the trash was imported before and there were no changes done to it.

At the minimum the importer should give a message specifying that the post is in the trash otherwise the user will not have any way to find the offending post and permanently delete it if he wants to import it.

The reason titles are compared at all is to let you reimport if the importing had failed in some way without generating duplicate posts, but in that case the posts will not be in the trash.

#5 in reply to: ↑ 4 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted

Replying to mark-k:

Exactly, if a post is in the trash it means that I don't want it and it should be ignored as if it is not in the DB any longer.

Sounds like the post should just be permanently deleted in that case.

I agree with closing for now, feel free to reopen with a patch.

#6 @mark-k
7 years ago

we have now a rewrite of the importer going on so it seems that patching is totally pointless here.. opened a ticket at the gsoc trac http://gsoc.trac.wordpress.org/ticket/367

Note: See TracTickets for help on using tickets.