This plugin has been deprecated! It is no longer necessary as its functionality has been integrated into WordPress. There will not be any continued support for it. Comments to this post are also now closed.
When I released the plugin, I also simultaneously made a bug report and patch for the WP core. After a couple weeks of discussion and a few suggested approaches, a patch was ultimately accepted and applied.
Reported as a bug in trac ticket #1073.
Fixed in WordPress in changeset #2496.
- This plugin assumes that you NEVER manually define the post slug. If you try to do so it will be ignored. If a post is currently published, changing the title will NOT update the post slug since you may break any potential links to your post (thus defeating the “perma” part of permalinks). However, you can change the value of the $update_published_posts argument to 1 to ALWAYS keep the post slug in sync, even when editing already published posts.
- WordPress v1.5.1 will likely address the need to keep the post slug in sync with the post title for drafts, and will do so in a much cleaner manner (since a clean solution requires changes to the core code). At the point in time of the release of this plugin, the bleeding-edge development version of WP 1.5.1 only has partial support for this. So this plugin may only have applicability to WP 1.5 only if 1.5.1 follows through on addressing this issue.
- Download the file sync-draft-slug-and-title.zip and unzip it into your /wp-content/plugins/ directory.
Copy and paste the the code ( sync-draft-slug-and-title.phps ) into a file called sync-draft-slug-and-title.php, and put that file into your /wp-content/plugins/ directory. Please ensure you do not introduce any spaces or other characters before the <?php or after the ?>
- Activate the plugin from your WordPress admin ‘Plugins’ page.
function c2c_sync_draft_slug_hack( $post_excerpt, $update_published_posts = 0 )
- $post_excerpt : The excerpt of the post about to be saved to the database (not really needed by this function, but used because we need to hook into the post data prior to it being saved to the db)
- $update_published_posts : optional; this indicates if changes to published posts should also change the post slug if the post title is changed; generally not recommended as you may break permalinks (in other words, other people’s links to your post might become invalidated); defaulted to 0
- 26 Mar 2005 : v0.9 — Released to the public
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
One reply on “Plugin: Sync Draft Slug and Title”
Great plugin, thanks! Trying to keep the post title and slug the same has been a bit annoying — this is just what I needed 🙂