Make Paths Relative

説明

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.

インストール

This process defines you the steps to follow either you are installing through WordPress or Manually from FTP.

From within WordPress

  1. Visit ‘Plugins > Add New’
  2. Search for Make Paths Relative
  3. Activate Make Paths Relative from your Plugins page.
  4. Go to “after activation” below.

Manually

  1. Upload the make-paths-relative folder to the /wp-content/plugins/ directory
  2. Activate Make Paths Relative through the ‘Plugins’ menu in WordPress
  3. Go to “after activation” below.

After activation

  1. Go to the plugin settings page and set up the plugin for your site.
  2. You’re done!

FAQ

Q. Why should I install this plugin?

A. Installing this plugin is the easiest way to make the paths(Permalinks + src) relative.

Q. May I select the paths which I want to be shown as relative items?

A. Yes, You can select the items you want to be relative.

Q. May I exclude some items to be shown as absolute?

A. Yes, You can exclude the items by using the add_filter (You can find the filters in the Description Area ).

評価

2022年7月8日 1 reply
I have a clean WordPress install using the Twenty Twenty-Two Version: 1.2 theme. The only plugin installed is yours, 'Make Paths Relative'. In settings I checked the box for 'Image Paths'. Then changed the WordPress > Settings > General > Timezone from 'London' to 'Los Angeles' Then BOOM! the following error appears: One or more database tables are unavailable. The database may need to be repaired. Upon investigation in myPHPAdmin we discovered that the _options table field 'option_name' > 'siteurl' and 'home' were blank where the websites url should be. Once, we manually put in the URL into these fields, went back to the site, and refreshed; it worked again until we changed the timezone back again. We also tested this on different web hosts, servers, and with different themes and were able to reproduce the behaviour.
2021年12月23日 1 reply
Not working with WP 5.8, broke site completely while links are still absolute.
2020年6月22日
This is just the perfect plugin: I installed it, easily set it the way I want it, then refreshed my site and immediately saw the results. If only all plugins were this straightforward, quick, and effective!
2019年10月31日
I didn't like the plugin. While enabled, it broke internal site links. Both http and https gave "too many redirects" error. Also, the tools to share on Twitter, Facebook, etc. gave error because the URL appeared relative (without the site domain). Just disable the plugin for both problems to end. I do not recommend.
15件のレビューをすべて表示

貢献者と開発者

Make Paths Relative はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。

貢献者

“Make Paths Relative” は5ロケールに翻訳されています。 翻訳者のみなさん、翻訳へのご協力ありがとうございます。

“Make Paths Relative” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。

変更履歴

1.3.0 – Dec 23, 2021

Earlier versions

  • For the changelog of earlier versions, please refer to the separate changelog.txt file.