Title: WP-Portability
Author: plankdesign
Published: <strong>2014 年 7 月 22 日</strong>
Last modified: 2015 年 10 月 26 日

---

搜尋外掛

![](https://ps.w.org/wp-portability/assets/banner-772x250.png?rev=953050)

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://ps.w.org/wp-portability/assets/icon.svg?rev=984371)

# WP-Portability

 由 [plankdesign](https://profiles.wordpress.org/plankdesign/) 開發

[下載](https://downloads.wordpress.org/plugin/wp-portability.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/wp-portability/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/wp-portability/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/wp-portability/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/wp-portability/#developers)

 [技術支援](https://wordpress.org/support/plugin/wp-portability/)

## 外掛說明

#### Summary

WP-Portability is a plugin designed to quietly make your site more portable. It 
is to designed to facilitate the work that needs to be done to be move a wordpress
install to another directory or server or domain name. It makes WordPress much less
attached and dependant on its install directory and domain name.

Though anyone can make use of WP-Portability, it was designed with developers in
mind. It greatly facilitates designing sites locally amongst a team of developers,
moving the site to a staging server and finally pushing it live.

#### Features

WP-Portability provides the following optimizations:

 * **Always local URLs**: Perhaps the biggest issues with relocating a wordpress
   install is the fact that every url pointing to other content in the same site(
   links to other pages, uploaded media, etc.) in the content of posts will break.
   This can be a nightmare to fix for larger sites. WP-Portability solves this by
   storing all local urls as a hidden shortcode in the database, which it can then
   expand to the correct path for whatever domain/install directory you view the
   site from. You will not see anything differently when you edit your posts, but
   rest assured that things are being handled dynamically in the background.
 * **Dynamic file paths**: This plugin will automatically determine the url of your
   WordPress install path. This will set the `WP_SITEURL` and `WP_HOME` constants.
   If these are already set in wp-config, this feature will not work. This feature
   will automatically disable itself on WordPress Multisite installations (network),
   as it will not work properly.
 * **Relative Rewrites**: This plugin changes the way WordPress creates apache-level
   rewrites, to always use relative paths, rather than absolute paths. This will
   enable access to the same installation via different routes (e.g. `http://domain.
   com` and `http://127.0.0.1/path/to/install`). This feature will automatically
   disable itself on WordPress Multisite installations (network), as it will not
   work properly.

### Upgrade

#### 1.0.1

 * Fixed bug in WordPress 4.0

## 安裝方式

#### Installation

 1. Make sure you are using WordPress 3.1 or later and that your server is running 
    PHP5
 2. Download the plugin
 3. Extract all the files.
 4. Upload everything to the `/wp-content/plugins/` directory.
 5. Activate the plugin through the ‘Plugins’ menu in the WordPress admin.
 6. Go to the portability settings page in the WordPress admin and adjust your settings.
 7. (optional) You can force the plugin to parse every post in your site for local 
    links by pressing the Insert Shortcode button. This may take a few minutes.
 8. That’s it. WP-Portability works silently.

#### Deactivation / Uninstallation

Unless you intend to reactivate the plugin shortly, you will need to clear all of
the hidden shortcodes out of your database.

 1. Go to the portability settings page in the WordPress Admin
 2. Press the ‘Purge Shortcode’ button. This may take a few minutes.
 3. Go to the Plugins page.
 4. Press the deactivate and/or delete plugin button.

## 常見問題集

  Can I use that mysterious shortcode myself?

Yes! The shortcode introduced by this plugin can absolutely be used to help you 
write out local links. The only caveat is that it will automatically be rendered
back to you whenever you save the post (save draft, publish or update). The syntax
is the following:

    ```
    [url {location}]
    ```

Where `{location}` is a part of the site to link to. Possible values include:

 * site : Will generate a url for the root installation directory
 * uploads: Will generate a url for the media upload directory
 * plugins: Will generate a url for the plugins directory
 * theme: Will generate a url for the main theme directory
 * stylesheet: Will generate a url for the child theme directory (if any). Otherwise,
   this is identical to theme.

You can then append your more specific path to the shortcode. For example:

    ```
    <img src="[url uploads]/2014/07/picture.jpg" alt="A vacation picture">

    <!-- Will evaluate to this: -->
    <img src="http://domain.com/wp-content/uploads/2014/07/picture.jpg" alt="A vacation picture">
    ```

  Why don’t all features work with a WordPress MultiSite install?

WordPress Multisite (network) installs greatly change the way wordpress structures
itself. As such, the fixes that this plugin introduces may conflict with this configuration.
Until further testing and development can be done, we have disabled the problematic
features automatically for the time being. This may be fixed in a future release.

  I deactivated/uninstalled the plugin and now my links don’t work and/or I see [
url site] littered throughout my post. How do I fix this?

If you intend to get rid of this plugin entirely (we are sorry to see you go!), 
then you should let the plugin purge its shortcodes from your database first. Before
you deactivate or uninstall the plugin, Go to the portability settings page in the
WordPress admin and press the Purge Shortcode button. This will safely convert all
local link shortcodes in your database back to absolute links.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈WP-Portability〉的開發相關工作。

參與者

 *   [ plankdesign ](https://profiles.wordpress.org/plankdesign/)
 *   [ frasmage ](https://profiles.wordpress.org/frasmage/)

[將〈WP-Portability〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/wp-portability)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/wp-portability/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/wp-portability/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/wp-portability/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/wp-portability/)。

## 中繼資料

 *  版本 **1.1.1**
 *  最後更新 **11 年前**
 *  啟用安裝數 **10+**
 *  WordPress 版本需求 ** 3.1 或更新版本 **
 *  已測試相容的 WordPress 版本 **4.0.38**
 *  語言
 * [English (US)](https://wordpress.org/plugins/wp-portability/)
 * 標籤:
 * [installation](https://tw.wordpress.org/plugins/tags/installation/)[shortcode](https://tw.wordpress.org/plugins/tags/shortcode/)
   [url](https://tw.wordpress.org/plugins/tags/url/)
 *  [進階檢視](https://tw.wordpress.org/plugins/wp-portability/advanced/)

## 評分

 3 星，滿分為 5 星

 *  [  1 個 5 星使用者評論     ](https://wordpress.org/support/plugin/wp-portability/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/wp-portability/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/wp-portability/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/wp-portability/reviews/?filter=2)
 *  [  1 個 1 星使用者評論     ](https://wordpress.org/support/plugin/wp-portability/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-portability/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/wp-portability/reviews/)

## 參與者

 *   [ plankdesign ](https://profiles.wordpress.org/plankdesign/)
 *   [ frasmage ](https://profiles.wordpress.org/frasmage/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/wp-portability/)