[WordPress] 外掛分享: Backwards Compatible Permalinks

首頁外掛目錄 › Backwards Compatible Permalinks
WordPress 外掛 Backwards Compatible Permalinks 的封面圖片
全新外掛
安裝啟用
尚無評分
2564 天前
最後更新
問題解決
WordPress 4.8+ PHP 5.6+ v0.1.0 上架:2019-03-10

內容簡介

倒序相容永久連結 (Backwards Compatible Permalinks) 是一款外掛,當更改永久連結結構時可協助防止 404 錯誤。

它透過追加一組倒序相容的文章重寫規則,實現此功能。這可以確保文章在永久連結結構更新後,仍然可以在其先前的永久連結上被訪問。

範例

假設您的永久連結結構設置為「年月和文章名稱」,並且您有一篇名為「我愛 WordPress」的文章。該文章會位於 https://example.com/2019/03/i-love-wordpress/ 位置。

但如果您想切換至「文章名稱」永久連結結構並將文章設在 https://example.com/i-love-wordpress/ 路徑下呢?

您可以這樣做,但結果是,訪問原始的文章永久連結時會回傳 404 錯誤。如果先前的 URL 被書籤或社交媒體分享,這將會造成問題。

安裝倒序相容永久連結後,您可以在舊的和新的永久連結結構上都訪問文章:

https://example.com/2019/03/i-love-wordpress/
https://example.com/i-love-wordpress/

注意事項

此外掛不具備過去相容性。也就是說,您必須在切換永久連結結構之前安裝並啟用此外掛,以便倒序相容性能夠運作。
目前僅支援標準文章。
因為永久連結結構正規表達式匹配之間的衝突,某些永久連結結構更新之間不支援倒序相容性。
倒序相容性僅提供給最近的永久連結結構更新。換句話說,您無法變更永久連結結構 3 次並跨越所有 3 種結構保持倒序相容性。

停用或解除安裝

在停用或解除安裝此外掛後,請確保您訪問 WordPress 後台的「設定 > 永久連結」以刷新您的重寫規則。

貢獻

我們歡迎您在GitHub上參與貢獻。

從 WordPress 內部安裝

造訪「外掛 > 新增外掛」。
搜尋「倒序相容永久連結」。
在外掛頁面啟用「倒序相容永久連結」。

手動安裝

將「backwards-compatible-permalinks」資料夾上傳至 /wp-content/plugins/ 目錄。
透過 WordPress 的「外掛」選單啟用「倒序相容永久連結」外掛。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Backwards Compatible Permalinks」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Backwards Compatible Permalinks helps prevent 404 errors when switching between permalink structures.
It achieves this by appending a set of backwards compatible post rewrite rules. This ensures posts are still accessible at their previous permalink after the permalink structure is updated.
Example
Let’s say your permalink structure is set to “Month and name” and you have a post titled “I Love WordPress.” That particular post would live at https://example.com/2019/03/i-love-wordpress/.
But what if you wanted to switch to the “Post name” permalink structure and have your post live at https://example.com/i-love-wordpress/ instead?
You could but this would result in the existing post permalink 404ing when visited. Which is problematic if the previous URL was bookmarked or shared on social media.
With Backwards Compatible Permalinks installed your post would be accessible at both the old and new permalink structures:

https://example.com/2019/03/i-love-wordpress/
https://example.com/i-love-wordpress/

Caveats

This plugin does not work retroactively. i.e. you must have the plugin installed and activated prior to switching permalink structures before backwards compatibility will work.
Currently only standard posts are supported.
Backwards compatibility is not supported between certain permalink structure updates. This is due to a clash between permalink structure regex matching.
Backwards compatibility is only provided between the most recent permalink structure update. i.e. you cannot change your permalink structure 3 times and have backwards compatibility across all 3 structures.

Deactivate or uninstall
After deactivating or uninstalling this plugin please ensure you visit Settings > Permalinks in the WordPress admin area to flush your rewrite rules.
Contributing
Contributions are welcomed on GitHub.
From within WordPress

Visit ‘Plugins > Add New’.
Search for ‘Backwards Compatible Permalinks’.
Activate Backwards Compatible Permalinks from your Plugins page.

Manually

Upload the backwards-compatible-permalinks folder to the /wp-content/plugins/ directory.
Activate the Backwards Compatible Permalinks plugin through the ‘Plugins’ menu in WordPress.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon