
Yeshuahin Alternative Post URLs
v1.0yeshuahin · 2026年11月26日 上架
Gives every post an alternative, shorter URL made of its main category and its post ID, for example /news/123/.
- 正在使用
- 10 以下
- 评分
- 暂无
- 累计下载
- 30
- 最近更新
- 2026年11月26日
需要 WordPress 5.0+已测试到 7.1.5PHP 7.2+
贡献者
Long post titles make long links. Yeshuahin Alternative Post URLs gives every post an alternative, shorter URL that is easy to copy, share and print, while the normal permalink keeps working. The short URL contains only the post’s main category and its post ID:
https://example.com/bangkok/20/
The URL stays valid when the post title or slug changes, because the ID never changes.
Features
- Works alongside your existing permalinks, with no redirect: the short URL shows the post directly and the normal permalink is used as the canonical URL for search engines.
- Uses the primary category set in Yoast SEO, Rank Math or SEOPress. Without one it uses the post’s first category.
- Shows the alternative URL in a new “Alt URL” column in the Posts list, with a Copy button, and in a box in the post editor.
- Shortcode
[alt_post_url]prints the alternative URL of the current post, or of a given post with[alt_post_url id="123"]. - No rewrite rules and no settings. It never needs a permalink flush and will not take over pages, date archives or other URLs: it only answers when the first part is an existing category and the second is the ID of an existing post.
- If permalinks are set to Plain, the alternative URL has the form
/?category_name=bangkok&p=20.
For developers
yhh_altpost_get_url( $post )returns the alternative URL of a post.yhh_altpost_main_categoryfilter changes the category used in the URL.yhh_altpost_redirect_to_permalinkfilter, returntrueto redirect the alternative URL to the normal permalink.