Title: WordPress Export exporting trashed items
Last modified: March 30, 2023

---

# WordPress Export exporting trashed items

 *  [shtv](https://wordpress.org/support/users/shtv/)
 * (@shtv)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/)
 * Hi there. Ive noticed that the wordpress export function is faulty because it
   is including trashed files in the final export file produced. This may be happening
   only when using the author filter in used in the export (Which i do on a daily
   basis).
 * This is a problem because…
    1. The other website with the imported file will have this deleted file for no 
       reason. This can cause confusion. There could be a file of the same name also(
       the correct version). Having a duplication can cause conflicts.
    2. The user might not know a trashed file has been exported/imported because it
       would not be expected
    3. If someone is exporting/importing files on a daily basis they will constantly
       see an error message saying “So and so post already exists”. That warning message
       does not specify the file is a trash file so the user could assume it is a normal“
       published” one. For alot of users this would cause confusion.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16615564)
 * What content are you exporting? Can you describe your export procedure step by
   step so that it can be reproduced?
 *  Thread Starter [shtv](https://wordpress.org/support/users/shtv/)
 * (@shtv)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16634169)
 * Ok the site in question has 1000 posts and 2 users. User A and User B.
 * I have 10 posts created by user B and i want to use the wordpress export function
   in tools to export just posts created by that user. (I assume everyone has the
   ability to export only posts from a specific user).
 * If user B has recently deleted a post (lets call it “Post about Holiday”) and
   left it in the trash the wordpress export tool will include that file in the 
   output. So you have 10 posts exported PLUS this trashed file that shouldnt be
   in there. (For people who dont know, exporting a post in wordpress creates an
   xml file. This can be useful as a quick backup or for migrating posts to another
   wordpress blog).
 * Everything will seem fine for the user until he/she decides to import the xml
   file in another wordpress site. After clicking on “import” in the tools folder
   the xml file appears to have been successfully incorporated into the new site.
   However a message comes up warning “Post about holiday already exists”.
 * Having done so many imports and exports over the years i managed to work out 
   this problem only happens if a user has recently put a post in the trash and 
   when only that user’s posts are filtered to be included in the export xml file
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).
 *  Thread Starter [shtv](https://wordpress.org/support/users/shtv/)
 * (@shtv)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16635319)
 * i should point out the warning message of a duplication occurs because the exporter
   is including the same trash file in all future exports. This problem only stops
   if the trash files file expires in the original site or it it is manually deleted.
   Unfortunately for the user there is no information to show the file in question
   is a trash file and most people would not assume trash files are being included
   in an export.
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16636843)
 * The export function itself is only available to administrators unless you change
   the permissions on the roles (e.g. with a plugin like User Role Editor).
 * When exporting, you can choose to export only posts from a specific user. You
   can also choose the desired status. It looks like this:
   [https://imgur.com/a/ly6iXUV](https://imgur.com/a/ly6iXUV)
 * So a user who makes an export can choose himself what he exports.
 * When importing, it will of course be checked if a post to be imported already
   exists. If it is, it will be skipped for the import. Here is a script that changes
   this behavior so that an existing post is updated: [https://gist.github.com/terrillmoore/70f7fefde462dc632515db28cc78a07a](https://gist.github.com/terrillmoore/70f7fefde462dc632515db28cc78a07a)
 * Here is a simpler variant of it: [https://stackoverflow.com/questions/71007601/how-can-i-disable-duplicate-post-check-in-wordpress-importer](https://stackoverflow.com/questions/71007601/how-can-i-disable-duplicate-post-check-in-wordpress-importer)
 *  Thread Starter [shtv](https://wordpress.org/support/users/shtv/)
 * (@shtv)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16636936)
 * Ok thankyou for looking into it but you havent addressed the bug where the wordpress
   exporter is exporting trashed posts? I would assume this was not intended because
   when doing a default export without any filters this does not happen.
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16637246)
 * As written above, you can select the status when exporting. Trashed is not there,
   but if you have selected “All”, “trash” is also taken into account as a status,
   so they are also exported – including their trash status.
 * This default behavior can also be influenced by hooks, e.g. you could influence
   the parameters for the export via [https://developer.wordpress.org/reference/hooks/export_args/](https://developer.wordpress.org/reference/hooks/export_args/).
 * If you consider this a bug, feel free to report it in the core trac so that developers
   can address it: [https://core.trac.wordpress.org/newticket](https://core.trac.wordpress.org/newticket)
 *  Thread Starter [shtv](https://wordpress.org/support/users/shtv/)
 * (@shtv)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16637416)
 * Is it possible to forward this issue to the wordpress team to fix. Because it
   slows things down when 99% of people do not want this to happen. Obviously because
   of its unexpected/hidden action alot of people would be unaware of this issue
   or would not understand the cause of duplicates.
 * The warning message is a bug in itself. it is saying a post exists when that 
   post actually is a deleted post.
 * I thought i was being helpful taking the time to represent users that use the
   export function regularly. Most people would like common sense to prevail in 
   software design and would definitely appreciate less clicks rather than more 
   clicks in the execution of an action. They would also appreciate warning messages
   that do not confuse and that are accurate.
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16638008)
 * I’ve already written you above where you can report what you consider a bug so
   developers can look at it and evaluate it. Here again the link to the Core Trac:
   
   [https://core.trac.wordpress.org/newticket](https://core.trac.wordpress.org/newticket)
 *  Thread Starter [shtv](https://wordpress.org/support/users/shtv/)
 * (@shtv)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16638142)
 * You are implying this might not be a bug or an issue to worry about. If someone
   has deleted a post it means they no longer have a use for it. If a that post 
   needs to be migrated/exported then they probably wouldnt delete it before exporting
   it. Does that make sense or not?
 * If i shouldnt be talking to you but instead should be reporting this as a bug
   elsewhere then can i ask why did you ask me to discuss it with you?
 * You asked me to explain the situation again but then showed little interest in
   the issue personally, little interest in whether it gets resolved or not. Maybe
   its not an issue that personally effects you. But that begs the question why 
   choose to get involved in this support question?
 * Sure some people might only have a small 6 post website. People like myself have
   6 websites which each have 1000s of posts. Having error messages and trying to
   find a needle in a haystack is the last thing a person needs to do when they 
   are already under alot of pressure.
 * This apparent lack of understanding/dismissive nature with your response is probably
   not the positive outcome most people would hope to achieve here.
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).
    -  This reply was modified 3 years, 2 months ago by [shtv](https://wordpress.org/support/users/shtv/).

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘WordPress Export exporting trashed items’ is closed to new replies.

## Tags

 * [deleted files](https://wordpress.org/support/topic-tag/deleted-files/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 2 participants
 * Last reply from: [shtv](https://wordpress.org/support/users/shtv/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/wordpress-export-exporting-trashed-items/#post-16638142)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
