外掛說明
WordPress 變更了媒體頁面,移除了 2 個定義媒體位置及子欄位的欄位。
與媒體位置相關的常數仍可使用於 wp-config.php 中,但這個常數不包含子網域。
這個外掛啟用後,便會在網站資料庫中新增兩個值,讓網站管理員之後可以依需求另行修改。
這個外掛的效用無法追溯至已上傳的圖片。
請參照〈安裝方式〉頁面中的說明,為已上傳的圖片進行移轉。
- 這個外掛與 WordPress 多站網路不相容。
- 請自行嘗試或在技術支援論壇尋找解決方案。
- 這個外掛的開發者不提供技術支援。
- 絕大多數的外掛問題均已解決。
安裝方式
首先,在使用這個外掛前,進行全站備份是最重要的一件事。開發團隊不負責承擔貴網站任何使用外掛的損失,外掛使用風險自負。感謝各位的配合及諒解。
一般來說,外掛的安裝方式非常簡單。安裝並啟用外掛之後,在外掛設定頁僅需輸入檔案上傳目錄的網址。請注意,如果輸入的網域不是現有網站使用的網域,請將這個與網站網域不同的網域 (DNS) 指向指定的目錄。
舉例來說,如果網站管理員要將 https://media.domain.com
設定為網站上傳資料夾,則必須將 media.domain.com
這筆 DNS 記錄指向目前 WordPress 網站的根目錄網址。
另一個例子,如果網站管理員要將 https://other-domain.com/images
設定為網站上傳資料夾,則必須將這個網域的 DNS 記錄指向目前 WordPress 網站的 images
資料夾網址。
了解這個外掛運作方式的最簡單方式,就是先僅使用目前 WordPress 網站的網域。依照預設,WordPress 網站的檔案上傳資料夾為 https://domain.com/wp-content/uploads
。請在外掛設定頁面中將預設設定變更為 https://domain.com/media
,然後在 WordPress 的媒體頁面上傳圖片,便會看到神奇的效果;WordPress 此時會在網站根目錄建立 media
資料夾,並將新上傳的圖片儲存在網站伺服器的新位置。
如果此時的 WordPress 網站為全新建置的網站,網站管理員接下來不必再進行其他變更;如果網站已上線一段時間且已依照 WordPress 預設值上傳過圖片,請繼續進行以下設定。
請注意,這個外掛對圖片網址進行的變更對已上傳的圖片不具追溯性。這代表變更媒體資料夾網址後,在網站中已插入現有文章/頁面中的舊圖片,仍會使用原有的網址。相同的,使用動態函式的範本及外掛會呼叫經過設定的新圖片網址,但對應的檔案仍儲存於舊資料夾中。
如需移轉已上傳圖片的網址,最簡單的方式是完成下列 3 個步驟:
步驟 1
在外掛設定頁中將設定變更為新網址。
步驟 2
將儲存於舊上傳資料夾的檔案移至新網址位置。舉例來說,舊上傳資料夾網址為 https://domain.com/wp-content/uploads
,而網站管理員想要圖片的新位置為 https://domain.com/media
,在外掛中就必須將新上傳位置設定為 https://domain.com/media
。然後網站管理員必須將 https://domain.com/wp-content/uploads
對應資料夾中的檔案移至 https://domain.com/media
對應的資料夾,這樣使用動態函式的功能便能繼續呼叫在新資料夾的媒體檔案。
步驟 3
我們以一張網址為 https://domain.com/wp-content/uploads/2016/05/test.jpg
、已使用於 WordPress 網站文章的舊圖片作為變更範例。由於接下來的操作具備一定程度的風險 (風險自負),網站管理員請務必先備份網站資料庫。新舊網址的變更,會需要搜尋/取代類的工具型外掛對網站資料庫進行修改。
這項操作有不少 WordPress 外掛表現得相當優異,Search & Replace 更是其中的佼佼者。
在搜尋/取代類的外掛中,搜尋 https://domain.com/wp-content/uploads
並取代為 https://domain.com/media
(用於取代的網址必須與步驟 1 中的相符)。
一般來說,如果網站管理員嚴格遵照上述步驟,均能輕易將網站上傳資料夾網址完成變更。
開發團隊會持續努力。如果這個外掛對網站有所幫助,請考慮為外掛撰寫評論。
常見問題集
-
這個外掛能否與 CDN 協同運作?
-
很抱歉,這個外掛無法搭配 CDN 使用,因為 WordPress 能直接處理上傳的檔案。
這個外掛僅適用於 WordPress 網站掛接鏡像子網域或變更檔案上傳位置。 -
外掛設定完成後,圖片無法顯示。
-
- 檢查路徑是否正確指定。
- 檢查在網站伺服器上建立的檔案是否正確指派 777 或 755 的檔案使用權限。
-
我的網站停擺了!
-
- 請別擔心。
- 請參考設定媒體欄位的線上說明。
- 如需復原網站狀況,網站管理員可以遵照解除安裝流程。
-
如何提出功能建議?
-
開發團隊非常樂見使用者願意協助我們改進 WP Original Media Path!
如果想參與這個開發專案,請前往外掛的 GitHub 存放庫。
使用者評論
參與者及開發者
變更記錄
2.4.2 | 2023-03-30
- Check WP 6.2
- Revert “Improve force to clean input regex”
2.4.1 | 2023-01-13
- Placeholder minor modification
- Improve force to clean input regex
- Input value improvement (thanks Rio Darmawan)
2.4.0 | 2018-10-22
- CHECK / End of support PHP 5.6
- ✓ Check compatbility WP 5.0
- If Expert mode, don’t modify lowercase, etc
2.3.0 | 2017-11-08
- NEW / possibility in “Expert” mode to modify the url scheme for the site
2.2.0 | 2017-10-31
- Minor spaces and clean
- Refactor activation methode with new setter
- Refactor method set value
- Refactor slug link admin options
- Refactor Pear conventions checkMultisite
- Refactor link plugin meta
- Rename method linkSidebar > addMenu
- Rename method linkPluginPage > pluginLinkPage
- Rename method loadTextDomain > loadLanguages
- Refactor Fields
- New namespace for class
- New requirement version (PHP, WP)
- Clean licence in php file
- REFACTOR / merge method assets (script, style)
- REFACTOR / change name singleton method
- Link page options printf()
- MOVE / page options in folder
2.1.1 | 2017-05-22
- MINOR / Explanatory text
- FIX / Load correctly gettext
- FIX / Link donate + I18n
- MINOR / changelog for WordPress repository
- Bump version WordPress Repository
2.1.0 | 2017-05-21
- NEW / Donate link
- MINOR / ajustement readme
- UPDATED / sanitize_url if empty field
- NEW / Expert mode with path custom
- UPDATED / function dynamic field render
- NEW / style in css file
- NEW / constante Version
- NEW / constante SLUG
2.0.0 | 2017-05-17
- MINOR / order button options
- NEW / Check multisite and kick out
- MINOR / Pear conventions
- MINOR / Add details for field
- NEW / Style for hide field in page media
- NEW / Sanitize field url
- UPDATED / activate() with new function
clean_slash
&set_uploadPath
- NEW / set_uploadPath
- NEW / clean_slash
- REMOVE / upload_path field
1.6.1 | 2016-08-01
- FIX / Install fields
1.6.0 | 2016-07-21
- NEW / Changelog GitHub
- UPDATED / readme GitHub
- MINOR / space
- MINOR / Update variable name
- UPDATED / i18n
- UPDATED / const NAME
- UPDATED / Pear conventions
- UPDATED / Activate function
- UPDATED / Class become final class
- MINOR / deleted comments
- NEW / Licence GPL V3
- Readme Markdown
- Update Readme
1.5.1 | 2015-11-19
- Check WordPress 4.4
- Update readme
- New File POT
- Github link
1.5.0 | 2015-08-28
- Settings API
- uninstall.php file
- recode
1.4.1 | 2014-09-22
- German Translation by Dr. Hajo Brandenburg – Feuerwehrmuseum
1.4.0 | 2014-09-03
- Correct classname responsive
- Check compatibility WordPress 4.0
- Update readme
- Update assets Repository
- Update and clean files PO & MO
1.3.0 | 2013-07-18
- Page options
- Possibility to disable the plugin settings without deleting
- Established translations
- Update Installation and FAQ
1.2.0 | 2013-05-01
- Bug link setting
- uninstalling the plugin with the deactivation
- Update FAQ
1.1.0 | 2013-03-29
- FAQ
- Auto fill fields
1.0.1. | 2013-01-06
- Contributors list
- Text fields
1.0.0. | 2012-12-28
- Launch Plugin