內容簡介
這個外掛有三種可能的情境下會執行功能。無論哪種情況,該附件頁面必須存在,若該附件已被刪除,此外掛不會運作:
A)訪客進入附件頁面,其上層文章仍然存在(未被刪除或放入回收站)。會發出301重新定向,將訪客重新定向至上層文章頁面。
B)訪客進入附件頁面,其上層文章已從回收站中刪除。會發出302重新定向,將訪客重新定向至首頁(如果您有需要,可以更改為301重新定向,請參考常見問題解答)。
C)訪客進入附件頁面,其上層文章已放入回收站中,因此訪客無法訪問。因此會返回404錯誤碼,以防止在舊版WordPress中重定向迴圈並重新導向到已放入回收站或不可用的文章。
此外掛沒有選項頁面,僅需啟用即可。
如果您對此外掛感到滿意,請不要忘記給予良好評價,這將激勵我繼續分享和改善此外掛(以及其他外掛)。
需求
WordPress 4.8或更新版本。
外掛標籤
開發者團隊
原文外掛簡介
There are three possible scenarios where this plugin does something. In all cases, the attachment page must exists, the plugin will not run for deleted attachments:
A) A visitor lands on an attachment page and the parent post is available (not in trash or deleted). A 301 redirect will be issued to redirect the visitor to the parent post.
B) A visitor lands on an attachment page and the parent post was already deleted from trash. A 302 redirect is issued to home page (this can be changed to 301 if you want, see FAQ for more details).
C) A visitor lands on an attachment page and the parent post is in trash, therefore not available for the visitor. It returns a 404 error code to prevent endless redirection loop in old WP releases and redirecting to trashed/not available posts.
There is no options page, simply activate it and will do the job.
If you’re happy with the plugin please don’t forget to give it a good rating, it will motivate me to keep sharing and improving this plugin (and others).
Requirements
WordPress 4.8 or higher.
