Title: Dynamic Hostname
Author: Takayuki Miyauchi
Published: <strong>2014 年 3 月 18 日</strong>
Last modified: 2015 年 4 月 26 日

---

搜索插件

![](https://ps.w.org/dynamic-hostname/assets/banner-772x250.png?rev=877017)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/dynamic-hostname_1b95bb.svg)

# Dynamic Hostname

 作者：[Takayuki Miyauchi](https://profiles.wordpress.org/miyauchi/)

[下载](https://downloads.wordpress.org/plugin/dynamic-hostname.0.4.2.zip)

 * [详情](https://cn.wordpress.org/plugins/dynamic-hostname/#description)
 * [评价](https://cn.wordpress.org/plugins/dynamic-hostname/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/dynamic-hostname/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/dynamic-hostname/#developers)

 [支持](https://wordpress.org/support/plugin/dynamic-hostname/)

## 描述

This plugin changes dynamically and automatically the host name which WordPress 
uses. For example, when you run WordPress on your different servers, for production,
development or staging, the host name will be changed dynamically and each site 
won’t have broken links. It’s very useful when you use it with Vagrant Cloud.

#### Some features

 * Temporarily changes the host name to the current host name ($_SERVER[‘HTTP_HOST’]).
 * Also replaces the host name of the links to the contents and the images in the
   same site.
 * The host name included in the contents on the development server will be changed
   to the one for the production server. (You don’t need to replace the host name
   in the database when you move it to the production server.)
 * The host name in the editor window is temporarily replaced with the current host
   name, so when you edit some on the development server, you never have broken 
   links.

#### Hooks to use for replacing

This plugin uses the filter hooks below to replace the host name in URL.

    ```
    $hooks = array(
        "home_url",
        "site_url",
        "stylesheet_directory_uri",
        "template_directory_uri",
        "plugins_url",
        "wp_get_attachment_url",
        "theme_mod_header_image",
        "theme_mod_background_image",
        "the_content",
        "upload_dir",
        "widget_text",
    );
    ```

Those hooks also have their own filter hooks, so you can customize with other plugins
you are using, etc.

    ```
    add_filter('dynamic_hostname_filters' function($hooks){
        $hooks[] = 'some_filter_hook';
        return $hooks;
    });
    ```

## 安装

#### Manual Installation

 1. Upload the entire `/dynamic-hostname` directory to the `/wp-content/plugins/` directory.
 2. Activate through the ‘Plugins’ menu in WordPress.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Dynamic Hostname」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Takayuki Miyauchi ](https://profiles.wordpress.org/miyauchi/)
 *   [ DigitalCube Inc. ](https://profiles.wordpress.org/megumithemes/)
 *   [ tekapo ](https://profiles.wordpress.org/tekapo/)
 *   [ Takashi Kitajima ](https://profiles.wordpress.org/inc2734/)
 *   [ Toro_Unit (Hiroshi Urabe) ](https://profiles.wordpress.org/toro_unit/)

[帮助将「Dynamic Hostname」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/dynamic-hostname)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/dynamic-hostname/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/dynamic-hostname/)，或通过[RSS](https://plugins.trac.wordpress.org/log/dynamic-hostname/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/dynamic-hostname/)。

## 更新日志

#### 0.4.1

 * Tested up to 4.1

#### 0.1.0

 * First release

## 额外信息

 *  版本 **0.4.2**
 *  最后更新：**11 年前**
 *  活跃安装数量 **300+**
 *  WordPress 版本 ** 3.8 或更高版本 **
 *  已测试的最高版本为 **4.2.39**
 *  语言
 * [English (US)](https://wordpress.org/plugins/dynamic-hostname/)
 * 标签
 * [hostname](https://cn.wordpress.org/plugins/tags/hostname/)[site_url](https://cn.wordpress.org/plugins/tags/site_url/)
 *  [高级视图](https://cn.wordpress.org/plugins/dynamic-hostname/advanced/)

## 评级

尚未提交反馈。

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

[查看全部评论](https://wordpress.org/support/plugin/dynamic-hostname/reviews/)

## 贡献者

 *   [ Takayuki Miyauchi ](https://profiles.wordpress.org/miyauchi/)
 *   [ DigitalCube Inc. ](https://profiles.wordpress.org/megumithemes/)
 *   [ tekapo ](https://profiles.wordpress.org/tekapo/)
 *   [ Takashi Kitajima ](https://profiles.wordpress.org/inc2734/)
 *   [ Toro_Unit (Hiroshi Urabe) ](https://profiles.wordpress.org/toro_unit/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/dynamic-hostname/)