NOTE: WordPress 4.5 incorporated the functionality of this plugin and thus it is no longer needed unless you're still running an older version of WP.
This plugin implements the belief that a trashed page or post should not in any way conflict with a new page or post when it comes to slugs. In essence, a new page or post should take precedence over anything in the trash. After all, the page/post is in the trash for a reason.
By default, WordPress takes into consideration posts and pages that have been trashed when deciding if the slug for a new post is already in use. Obviously, in general, WordPress should not allow duplicate slugs because that could interfere with permalinks. The thinking behind WordPress's handling of the situation is that trashed posts/pages are still technically present, just inaccessible. It is possible 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.
If what WordPress does is unclear, here's an example to help clarify things:
- WordPress ships with a page called "About" with the slug of "about". The page's URL would be http://yoursite/about/
- Let's say you trash that page and start a new page with the name "About".
- Due to a trashed page having the slug that would normally have been assigned to the new page ("about"), the new page gets the slug of "about-2", resulting in the page's URL being http://yoursite/about-2/
With this plugin, for this example, the new "About" page would get the slug "about" as one would hope.
That said, the plugin tries its best to restore untrashed posts to their original slug. The only time it fails to do so is if a new page or post has claimed the trashed post's original slug, in which case the untrashed post is assigned a new slug.
See other sections of the documentation for more insight into the plugin's functionality. See WP core
ticket #11863 for discussion on the matter.
Links:
Plugin Homepage |
Plugin Directory Page |
Author Homepage
1.2 (2016-05-07)
Highlights: WordPress 4.5 has effectively implemented the functionality provided by this plugin, thus it is no longer needed.
- New: Self-deactivate and show deprecation notice if plugin is active under WP 4.5+ and don't do anything else.
- New: Migrate existing meta keys that stored original post slugs to the meta key used by WP.
- New: Add unit tests that only run under versions of WP equal to or greater than 4.5.
- Change: Prevent existing tests from running under versions of WP older than 4.5.
- Change: Prevent web invocation of unit test bootstrap.php.
- Change: Prevent direct loading of test file.
- Change: Add 'Text Domain' plugin header.
- New: Create empty index.php to prevent files from being listed if web server has enabled directory listings.
- New: Add LICENSE file.
1.1 (2015-12-08)
Highlights:
- This minor release sync's the plugin's checks with those recently added/changed in core and enhances the unit tests.
详细信息 :
- Change: Re-sync
get_trashed_post() with changes to wp_unique_post_slug()
- Check for slugs that could result in URLs that conflict with date archives
- Simplify post hierarchy checking for hierarchical post types
- Change: Modify many unit tests to use a dataProvider to allow testing for both posts and pages
1.0.4 (2015-12-07)
Highlights:
- This is a very minor update primarily consisting of documentation improvements, including an addition that provides an overview of the plugin's approach to the problem it solves and documentation for all unit tests.
Details:
- Add: Create new section in readme explaining the implemented solution to the trash slug conflict problem
- Add: Document the purpose and expectations of each unit test
- Change: Improvements to existing documentation
- Change: Switch a majority of unit tests to work with posts rather than pages (though it doesn't really matter)
- Change: Minor code formatting changes (braces)
- Change: Explicitly declare methods in unit tests as public
- Change: Minor improvements to inline docs and test docs
- Change: Note compatibility through WP 4.4+
- Change: Update copyright date (2016)
1.0.3 (2015-02-11)
- Note compatibility through WP 4.1+
- Update copyright date (2015)
1.0.2 (2014-08-25)
- Add an FAQ question regarding why WP core doesn't do things the way the plugin does things
- Minor code reformatting (bracing)
- Change documentation links to wp.org to be https
- Change donate link
- Note compatibility through WP 4.0+
- Add plugin icon
1.0.1
- Add
c2c_No_Slug_Conflicts_With_Trash::version() to return version number for plugin (with unit test)
- Note compatibility through WP 3.8+
- Update copyright date (2014)
- Change donate link
1.0