[WordPress] 外掛分享: Make Paths Relative

WordPress 外掛 Make Paths Relative 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Make Paths Relative」是 2016-06-15 上架。 目前已經下架不再更新,不建議安裝使用。
  • 目前有 4000 個安裝啟用數。
  • 上一次更新是 2022-05-25,距離現在已有 1075 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.5 以上版本才可以安裝。
  • 有 15 人給過評分。
  • 論壇上目前有 1 個提問,問題解答率 0%

外掛協作開發者

sasiddiqui | aliya-yasir |

外掛標籤

GDPR | urls | links | paths | relative |

內容簡介

這個外掛程式可以將路徑(URL)轉換為相對路徑而非絕對路徑。這個外掛程式對於使用相對路徑特別有用。以下是這個外掛程式可以輕易轉換為相對路徑的永久連結和 src 清單:

文章永久連結
封存頁面的永久連結
作者永久連結
標籤永久連結
腳本路徑(src)
樣式路徑(src)
圖像路徑(src)

這個外掛程式可以將上述所有的永久連結和 src 都轉換為相對路徑。您可以從外掛程式的設定頁面選擇選項。

過濾器

如果您想要排除某些永久連結或 src 的相對轉換,您可以在您的佈景主題的 functions.php 或您自己的自訂外掛程式中使用 paths_relative 過濾器。

以下是範例過濾器(如下面的過濾器將把 jquery.js 的路徑轉換為絕對路徑):

function yasglobal_change_path( $link ) {
if( $link == '/wp-includes/js/jquery/jquery.js?ver=1.12.4' ) {
$link = site_url().'/wp-includes/js/jquery/jquery.js?ver=1.12.4';
}
return $link;
}
add_filter( 'paths_relative', 'yasglobal_change_path' );

如果您不想將 srcset(響應式圖像)的路徑轉換為相對路徑,只需要在您的佈景主題的 functions.php 中加入以下提及的行。

add_filter( 'srcset_paths_relative', '__return_false' );

如果您想要讓外掛程式在不需要檢查/訪問設定頁面的情況下即可將所有路徑轉換為相對路徑,只需要在您的佈景主題的 functions.php 中加入以下行。

add_filter( 'make_paths_relative_activate_all', '__return_true' );

請確認設定頁面
感謝您的支援

喜愛 Make Paths Relative 的使用者提供的支援非常重要。您可以給我一則 5 星評價和一條漂亮的留言,以支援 Make Paths Relative 未來的發展,並使其更加完善。

錯誤報告

錯誤報告可以在 GitHub 上提交(Make Paths Relative)。請注意,GitHub 不是支援論壇,未被正確歸類為錯誤的問題將被關閉。

原文外掛簡介

This plugin can make(convert) the paths(URLs) to a relative instead of absolute. This plugin is useful for using relative URLs. The given below list of permalinks and src can be easily converted to a relative:

Post Permalinks
Archive Permalinks
Author Permalinks
Term Permalinks
Scripts Paths(src)
Styles Paths(src)
Image Paths(src)

All the above permalinks and src can be converted to a relative instead of absolute by using this plugin. You can select the options from the plugin settings page.
Filters
If you want to exclude some Permalink or src to be relative then you can use paths_relative filter in your theme’s functions.php or in your custom plugin.
Your filter may look like this (Below filter would make the jquery.js Path to absolute):
function yasglobal_change_path( $link ) {
if( $link == '/wp-includes/js/jquery/jquery.js?ver=1.12.4' ) {
$link = site_url().'/wp-includes/js/jquery/jquery.js?ver=1.12.4';
}
return $link;
}
add_filter( 'paths_relative', 'yasglobal_change_path' );

If you don’t want to Make the Paths relative for srcset(Responsive Images) then just add the below-mentioned line in your theme’s functions.php.
add_filter( 'srcset_paths_relative', '__return_false' );

If you want to make plugin works and all the paths relative without going to check/visit Settings Page so, just add this line in your theme’s functions.php.
add_filter( 'make_paths_relative_activate_all', '__return_true' );

Make sure to check the settings Page
Thanks for the Support
The support from the users that love Make Paths Relative is huge. You can support Make Paths Relative future development and help to make it even better by giving a 5-star rating with a nice message to me 🙂
Bug reports
Bug reports for Make Paths Relative are welcomed on GitHub. Please note GitHub is not a support forum, and issues that aren’t properly qualified as bugs will be closed.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Make Paths Relative」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.2.1 | 0.4.1 | 0.5.1 | 0.5.2 | 0.5.3 | 0.5.4 | 0.5.5 | 0.5.6 | 0.5.7 | 1.0.0 | 1.1.0 | 1.1.1 | 1.1.2 | 1.2.0 | 1.2.1 | 1.3.0 | trunk |

延伸相關外掛(你可能也想知道)

  • Deploy Helper 》簡化網站部署的過程。如果您曾在本地環境上使用 WordPress 站點,您就知道將其移植到不同的伺服器是多麼令人沮喪。, 外掛主頁, 論壇/支援。
  • Pathpic 》使用方法?, 使用文件管理器 Windows 或 Linux 的路徑列表製作繪製路徑層級的圖片 (可以是 PNG 圖像或樹形文本)。, 為什麼使用它?, 您可以節省時間,因為您...。

文章
Filter
Mastodon