
外掛標籤
開發者團隊
② 後台搜尋「Yeshuahin Alternative Post URLs」→ 直接安裝(推薦)
原文外掛簡介
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_category filter changes the category used in the URL.
yhh_altpost_redirect_to_permalink filter, return true to redirect the alternative URL to the normal permalink.
