
外掛標籤
開發者團隊
原文外掛簡介
WordPress stores slugs in a column 200 characters long. A Thai letter takes 9 characters once encoded for a URL, so a Thai title is cut after about 22 letters, often in the middle of a syllable. Parich Long Slug makes room for long slugs, keeps them safe through WordPress updates, and repairs the damage another plugin, Long URL Maker, has done on many sites.
Long slugs
Slugs up to 1,000 bytes by default (about 110 Thai letters), adjustable from 200 to 1,900 under Settings → Long Slug, with a live preview.
Cut on a letter boundary: vowels and tone marks stay with their consonant, and a slug never ends with a leading vowel (เ แ โ ใ ไ).
Everything else works as in WordPress: the same characters are removed, and a slug that fits in 200 bytes comes out exactly as WordPress makes it.
Works from every editor: the block editor, Quick Edit, the classic editor, REST and WP-CLI. When the block editor’s slug field drops Thai vowels and tone marks, they are put back on save.
Safe through WordPress updates
When WordPress updates its database, it changes the slug columns back to 200 characters and cuts every longer slug. That is what breaks sites using Long URL Maker. This plugin:
installs a small file in wp-content/mu-plugins (the “guard”) that stops WordPress from shortening the columns, also during the update itself, when other plugins are not loaded;
keeps a copy of every slug longer than 200 characters, and if the columns were shortened anyway (the guard was removed), widens them again and puts the cut slugs back on the next page load.
Repair what Long URL Maker damaged
Long URL Maker cuts slugs at 200 characters when WordPress updates, rewrites every slug from its title when it is deactivated, and puts old slugs back whenever the WordPress version changes. Settings → Long Slug → Repair slugs finds that damage and proposes the original slugs:
It looks for evidence of what each slug was: Long URL Maker’s own backup table, the slug a trashed post had, SEO plugin data (Yoast SEO, Rank Math), 404 logs (Redirection, Rank Math, 301 Redirects), existing redirects, links on your site, titles and their revisions, and URL lists or CSV files you import.
Every proposal shows its evidence. Items with strong evidence are pre-selected as “Ready”; doubtful ones are left for you to check; the scan never changes anything by itself.
Repairs change only the slug (not the modified date), in batches, and can be undone batch by batch.
Every old address is redirected (301) to the repaired post or term, including the addresses of child pages and of posts whose links contain a repaired category.
Keys used by WordPress and plugins are repaired too: ACF field and field group keys, templates and template parts, global styles, custom CSS.
Addresses from 404 logs that match nothing can be pointed at a post by hand.
For developers
WP-CLI: wp parich-slug scan, repair, undo, redirects, import-urls, import-csv, clear-imports.
Filters: parich_slug_max_length, parich_slug_capability, parich_slug_repair_post_types, parich_slug_repair_taxonomies, parich_slug_repair_system_post_types, parich_slug_guard_file.
Source code
The complete source and its tests are on GitHub: github.com/parich/parich-long-slug.
Credits
The functions that reproduce the slugs Long URL Maker made are ported from Long URL Maker 2.0.1 by kpcode, itself based on PP-auto-thai-url by Preukson (both GPLv2 or later), so the repair tool can recognise its slugs exactly.
