Prevent New Slug Conflicts With Trash In WordPress

When a post is deleted, it it not completely removed from your website. It goes to trash. You can access trash content by visiting your admin area dashboard Posts -> All Posts then by clicking the ‘Trash’ filter. Same can be done for pages and other custom post types. 

What is WordPress trash slug conflict?

You must have noticed that the page or post in trash conflicts with new post or post having same slug in your WordPress site. Likewise you cannot use same slug which a trashed post has in your website. To use same slug, first you will be having to completely delete that old post from trash.

For instance: Suppose you create a contact page with slug /contact the you delete it and it moves to trash. After sometime you again try to create a contact page.

Now this time you page’s slug will come /contact-2 or something and also you will not be able to edit it back to /contact, until and unless you delete your old page from trash.

Why similar slug conflict happens with trash in WordPress

Actually slug conflict happens to avoid conflicts with permalinks. By default, WordPress takes into account posts and pages that have been trashed when deciding if the slug for a new post is already in use.

It is because WordPress does not want to allow duplicate slugs because that could interfere with your website’s permalinks. The thinking behind WordPress’s handling of the situation is that trashed posts/pages are still technically present, just temperately inaccessible.

And there are chances that an author or admin would choose to restore a post from the trash, which WordPress feels should then occupy that same permalink as before it was trashed.

Hence, this happens for a good reason but sometimes we don’t want it this way.

How to resolve this issue?

No Slug Conflicts with Trash is a WordPress plugin that prevents the slug of a trashed page or post from conflicting with the slug desired for a new page or post.

What all you have to do is install and activate No Slug Conflicts with Trash plugin in your WordPress site. Yes, the plugin generates lots of questions like what if you trash a post, publish another post with same slug and then restore the old one etc? Take a look over to this plugin’s FAQs and you will know.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.