Description
When a post title contains multi-byte characters (such as Japanese), WordPress generates a URL-encoded slug like %e3%81%82..., which results in a long and unreadable permalink.
This plugin replaces such auto-generated slugs with {post_type}-{post_ID} (e.g. post-123). A multi-byte slug is kept as-is when the user has explicitly specified it.
Optionally, new categories, tags and other terms with a multi-byte name can get a slug such as category-12.
Usage
- Go to “Settings” -> “Default Permalink” in the WordPress admin.
- Check “Enable” and save changes.
Slug formats, target post types, the bulk conversion and more are explained in the usage guide: https://www.redwoodcity.jp/app/default-permalink/en/usage-en/
WP-CLI
wp default-permalink statusshows the settings and the number of posts with a multi-byte slug.wp default-permalink convert --dry-runlists the posts to convert and their new slugs;wp default-permalink convertconverts them all (no 50-post limit).--post_type,--limitand--afterconvert a large site in steps. See the documentation: https://www.redwoodcity.jp/app/default-permalink/en/docs-en/
Convert a single post
In the post, page and media lists, a post that still has a multi-byte slug shows a “Convert slug” link under its title (when the plugin is enabled and you can edit the post). It converts just that post to the selected format; the old URL is redirected to the new one.
Site Health
Tools -> Site Health recommends enabling the plugin when it is installed but not enabled, and shows how many posts still have multi-byte slugs, with a link to the settings screen.
Installation
- Upload the
default-permalinkfolder to the/wp-content/plugins/directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- Enable the plugin’s behavior from “Settings” -> “Default Permalink”.
FAQ
More questions and answers: https://www.redwoodcity.jp/app/default-permalink/en/faq-en/
-
Can I still use a Japanese (multi-byte) slug?
-
Yes. A slug you enter explicitly (in the editor’s URL/slug field, Quick Edit, the REST API
slugparameter, etc.) is kept as-is. Only slugs generated automatically from the title are replaced. If you clear the slug and save, a new one is generated and replaced. -
Which posts are affected?
-
Posts of the selected post types, saved from the editor or created directly (REST API, WP-CLI,
wp_insert_post(), media uploads). Existing posts are not changed until you run the bulk conversion. -
Does it change category and tag slugs?
-
Only if you select them under “Target taxonomies” (off by default). New terms get a slug such as
category-12. Existing terms are not changed, because WordPress does not redirect old term URLs. -
How do I customize the slug format?
-
Use the
default_permalink_slugfilter for posts anddefault_permalink_term_slugfor terms. The result is made unique automatically. Examples and parameters: https://www.redwoodcity.jp/app/default-permalink/en/docs-en/ -
What happens to old URLs after a slug is converted?
-
They are redirected to the new permalink (301). For posts and other non-hierarchical post types, WordPress stores the old slug. WordPress does not do this for pages and other hierarchical post types, so since 1.12.0 the plugin stores the old path of a published page it converts (bulk conversion, “Convert slug” or WP-CLI) and redirects it, including the URLs of its child pages. Pages converted before 1.12.0, and page slugs changed by hand, are not redirected: set up a redirect yourself if needed. Use the
default_permalink_redirect_old_pathsfilter to turn the page redirects off.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Default Permalink” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Default Permalink” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.12.0
- Old URLs of pages (and other hierarchical post types) are now redirected (301) after the plugin converts their slug with the bulk conversion, the “Convert slug” row action or
wp default-permalink convert. WordPress only does this for posts, so converted pages used to return 404. The URLs of child pages under a converted page are redirected too. Only published pages converted from 1.12.0 on are covered; thedefault_permalink_redirect_old_pathsfilter turns this off. - Uninstalling the plugin also removes the stored old page paths.
1.11.0
- Added a “Convert slug” row action to the post, page and media lists: it converts the multi-byte slug of that one post to the selected format, without running the bulk conversion. It is shown only to users who can edit the post, and is protected by a nonce.
1.10.3
- Fixed:
wp default-permalink convert --limitno longer suggests continuing with--afterwhen no posts are left after the last processed one (only posts that failed or come before--afterremain). With--dry-run, it now also shows the--aftervalue to continue with.
1.10.2
- Fixed: the bulk conversion of a scheduled post whose time has passed no longer lets the next cron run publish it (1.10.1 kept the status but WordPress re-created the publish event). The existing schedule of a scheduled post is left unchanged.
- Fixed: the block editor no longer reports an old “slug changed” record (for example from Bulk Edit) when the slug was changed in the save being made.
1.10.1
- Fixed: with the “post date and ID” format, the slug now uses the date being saved (for example the scheduled date), not the previous date.
- Fixed: the bulk conversion (screen and WP-CLI) no longer publishes scheduled posts whose time has passed; it only changes the slug.
- Fixed: in the classic editor, a multi-byte slug typed in the permalink box is now previewed as typed (it was always saved as typed).
- Fixed: clearing the slug of a child category no longer appends the parent’s slug.
- The Site Health check no longer flags remaining multi-byte slugs as a problem (they may have been entered on purpose); it shows the count instead.
wp default-permalink convertaccepts--after=<ID>to continue a run stopped by--limit.- Quick Edit saves no longer leave a “slug changed” record behind, and the block editor screen no longer discards it unseen.
1.10.0
- Added a Site Health check: it recommends enabling the plugin, or converting the posts that still have multi-byte slugs (WordPress 5.2 or later).
wp default-permalink convertnow accepts--post_type=<types>and--limit=<number>to convert a large site in steps.
1.9.2
- Fixed: deleting the plugin on a multisite network now removes its settings from every site, not only the current one.
- Posts created by WP-CLI, imports or cron no longer leave a “slug changed” notice record behind (nobody sees it). Use the
default_permalink_record_noticefilter to change this.
1.9.1
- Bulk conversion on the settings screen now continues from where the previous run stopped, so posts that cannot be converted no longer block the rest. Failed posts are reported and retried after the remaining posts.
1.9.0
- Added WP-CLI commands:
wp default-permalink statusandwp default-permalink convert [--dry-run].
1.8.0
- The block editor now shows the “slug changed” notice right after saving (previously it appeared the next time the edit screen was opened).
- The bulk conversion tool now previews the posts the next run converts, with their current and new slugs.
1.7.0
- Added term slug replacement: select target taxonomies (categories, tags, etc.) and new terms with a multi-byte name get a slug such as category-12. Off by default. Existing terms are not changed.
- Added the default_permalink_term_slug filter.
1.6.0
- Behavior change: posts created directly (REST API, WP-CLI, wp_insert_post(), media uploads) now get the replacement slug. Previously only posts saved from the editor were replaced.
- Behavior change: if you clear the slug of a published post and save it, the newly generated multi-byte slug is now replaced (an empty slug is treated as “not specified”). Previously the multi-byte slug was kept.
- Fixed: a multi-byte slug explicitly entered for a new post or an unsaved draft was replaced when the post was published in the same request.
- Fixed: the replacement slug was not checked for uniqueness, so it could duplicate an existing slug (e.g. a page already using “post-123”). A suffix such as “-2” is now added.
- Fixed: the “slug changed” admin notice could be recorded by a permalink preview (opening the editor) even when nothing was saved.
- The “slug changed” notice is now shown and cleared only on the post edit screen.
1.5.1
- Updated the plugin and author URLs to the new product site (https://www.redwoodcity.jp/app/default-permalink/).
- Code quality: WordPress Coding Standards compliance and Plugin Check annotations. No functional changes.
1.5
- Added an admin notice shown after a slug has been automatically replaced.
- Added a bulk conversion tool for existing multi-byte slugs. Old URLs are redirected (301) by the WordPress core old-slug mechanism.
- Hardened: slug replacement is skipped when no post ID is available (prevents colliding “post-0” slugs on direct wp_insert_post calls).
1.4
- Added slug format options: post type and ID (post-123), post date and ID (20260613-123), or a random string (a1b2c3d4).
- Added target post type selection.
1.3
- Added uninstall cleanup: plugin options are deleted when the plugin is uninstalled.
- Added a Settings link on the Plugins screen.
- Added the default_permalink_slug filter for customizing the generated slug.
1.2
- Confirmed compatibility with the latest WordPress.
- Replaced the deprecated get_page() with get_post() (fixes a fatal error on PHP 8).
- Hardened the settings page: output escaping, sanitize callback for the option, checked() helper.
- Made the settings page strings translatable and load the plugin text domain.
1.1
- Added Japanese translation.
1.0
- Initial release.
The changelog of every version, with downloads: https://www.redwoodcity.jp/app/default-permalink/en/changelog-en/
