Title: Stage WP Plugin Manager
Author: Andrés Villarreal
Published: <strong>2014 年 4 月 11 日</strong>
Last modified: 2014 年 12 月 7 日

---

搜索插件

![](https://ps.w.org/stage-wp-plugin-manager/assets/banner-772x250.png?rev=891037)

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

![](https://s.w.org/plugins/geopattern-icon/stage-wp-plugin-manager_5b3333.svg)

# Stage WP Plugin Manager

 作者：[Andrés Villarreal](https://profiles.wordpress.org/andrezrv/)

[下载](https://downloads.wordpress.org/plugin/stage-wp-plugin-manager.1.0.zip)

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

 [支持](https://wordpress.org/support/plugin/stage-wp-plugin-manager/)

## 描述

If you develop in a local machine, at some point you’ll have some active plugins
there that you don’t need in the servers that you’re deploying to. Sure, you can
deactivate them in your local machine before deploying, or after deploying in the
remote ones, but you’re gonna need them again to be active if you want to perform
local work in the future, specially when you update your local database from a remote
one. On such kind of scenarios, the whole process of manually activating and deactivating
plugins for each stage can be really frustrating, sometimes even taking a lot of
your time.

Stage WP Plugin Manager is meant to solve that problem in an quick and elegant way,
by doing an automatic “fake” activation of the plugins you select for each stage:
every plugin you attach to a stage will be immediatly treated as an active plugin
on that stage, no matter what its previous status was, or its current status on 
the other stages. Since the list of active plugins is just filtered instead of rewritten,
you can restore the previous status of a plugin by detaching it, and go back to 
your original setup by deactivating Stage WP Plugin Manager.

**Please read the following instructions very carefully.**

#### Getting Started

Stage WP Plugin Manager works on some assumptions about your workflow:

 * You have a constant named `WP_STAGE` defined in your WordPress configuration 
   file (often `wp-config.php`).
 * The value of `WP_STAGE` is one of the supported stages. The default supported
   stages are `local`, `staging` and `production`.
 * The value of `WP_STAGE` is different in each of your stages.

Some developers prefer to keep different configuration files for each one of their
stages, or change the values of their constants based on some evaluation. For example,
you could have something like this in your `wp-config.php` file:

    ```
    if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
        define( 'WP_STAGE', 'local' );
    } elseif ( file_exists( dirname( __FILE__ ) . '/staging-config.php' ) ) {
        define( 'WP_STAGE', 'staging' );
    } else {
        define( 'WP_STAGE', 'production' );
    }
    ```

If you follow this example, note that `local-config.php` should not be included 
in your deployments to staging and production, and both `local-config.php` and `
staging-config.php` should not exist in your production stage.

#### Attach & Detach

Once you have installed this plugin, you will notice that a new link appears under
each active plugin of the list, which reads “Attach to [your-stage] stage”. By clicking
that link, you are setting a plugin to be always active in the stage you’re working
at, and not active on the other stages (unless you attach the plugin to the other
stages too).

In case you want to remove a plugin from the list of active plugins for a stage,
you just need to click the “Detach from [your-stage] stage”.

Additionally, you can make bulk selections of plugins to be attached or detached
for each stage by going to _Plugins > Stage Management_.

#### Add & Extend Functionality

Stage WP Plugin Manager allows you to extend its functionality by offering hooks
for filters and actions.

For example, you can add your custom stages or even remove the default ones by hooking
in the `stage_wp_plugin_manager_stages` filter, having something like this in your
plugin:

    ```
    function add_stages( $stages ) {
        $stages[] = 'other';
        return $stages;
    }
    add_filter( 'stage_wp_plugin_manager_stages', 'add_stages' );
    ```

Additionally, you can give a nicer name to your new stage by hooking in the `stage_wp_plugin_manager_stages_txt`
filter:

    ```
    function add_stages_txt( $stages_txt ) {
        $stages_txt['other'] = __( 'Other stage' );
        return $stages_txt;
    }
    add_filter( 'stage_wp_plugin_manager_stages_txt', 'add_stages_txt' );
    ```

Here’s the complete list of actions and filters that Stage WP Plugin Manager offers:

Action hooks

 * `stage_wp_plugin_manager_before_init`: Perform some process before Stage WP Plugin
   Manager initializes.
 * `stage_wp_plugin_manager_init`: Perform some process after Stage WP Plugin Manager
   initializes.

Filter hooks

 * `stage_wp_plugin_manager_stages`: Modifiy the current supported stages.
 * `stage_wp_plugin_manager_default_stage`: Modify the default stage.
 * `stage_wp_plugin_manager_managed_plugins`: Modify the list of plugins managed
   by Stage WP Plugin Manager.
 * `stage_wp_plugin_manager_stage_plugins`: Modify the list of plugins attached 
   to the current stage.
 * `stage_wp_plugin_manager_non_stage_plugins`: Modify the list of managed plugins
   that are not attached to the current stage.
 * `stage_wp_plugin_manager_nonce_key`: Modify the nonce key used for data validation.
 * `stage_wp_plugin_manager_help_description`: Modify contents of “Description” 
   help tab.
 * `stage_wp_plugin_manager_help_getting_started`: Modify contents of “Getting Started”
   help tab
 * `stage_wp_plugin_manager_help_attach_detach`: Modify contents of “Attach & Detach
   Plugins” help tab
 * `stage_wp_plugin_manager_help_add_extend`: Modify contents of “Adding Stages &
   Extending” help tab
 * `stage_wp_plugin_manager_help_credits`: Modify contents of “Credits” help tab

#### WordPress MultiSite Compatibility

If you’re using MultiSite and set this plugin to network activated, you can use 
it to attach plugins to stages on a sitewide basis 🙂

#### Improve Your Workflow

This plugin was originally meant as a complement for [WP Bareboner](http://github.com/andrezrv/wordpress-bareboner),
an advanced Git model repo, and [Stage WP](http://github.com/andrezrv/stage-wp),
a deployment tool based in Capistrano. The three projects work really well separated,
but their real power can only be seen by using them together.

#### Contribute

You can make suggestions and submit your own modifications to this plugin on [Github](https://github.com/andrezrv/stage-wp-plugin-manager).

## 屏幕截图

[⌊Plugins page with links to attach the plugin to the current stage.⌉⌊Plugins page
with links to attach the plugin to the current stage.⌉[

Plugins page with links to attach the plugin to the current stage.

[⌊Stage WP Plugin Manager settings, where you can attach plugins to any stage.⌉⌊
Stage WP Plugin Manager settings, where you can attach plugins to any stage.⌉[

Stage WP Plugin Manager settings, where you can attach plugins to any stage.

[⌊Advanced help.⌉⌊Advanced help.⌉[

Advanced help.

## 安装

 1. Unzip `stage-wp-plugin-manager.zip` and upload the `stage-wp-plugin-manager` folder
    to your `/wp-content/plugins/` directory.
 2. Activate the plugin through the **“Plugins”** menu in WordPress.
 3. Read carefully the instructions in [description page](https://wordpress.org/extend/plugins/stage-wp-plugin-manager/).

## 评价

![](https://secure.gravatar.com/avatar/f39153406212fb948b79ba788edb5341205b1486c15100e30b267d74782eb446?
s=60&d=retro&r=g)

### 󠀁[This guy deserves a medal.](https://wordpress.org/support/topic/this-guy-deserves-a-medal/)󠁿

 [tomathyg](https://profiles.wordpress.org/tomathyg/) 2016 年 12 月 18 日

An absolute must for local development.

 [ 阅读所有3条评价 ](https://wordpress.org/support/plugin/stage-wp-plugin-manager/reviews/)

## 贡献者及开发者

「Stage WP Plugin Manager」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Andrés Villarreal ](https://profiles.wordpress.org/andrezrv/)

[帮助将「Stage WP Plugin Manager」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/stage-wp-plugin-manager)

### 对开发感兴趣吗?

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

## 更新日志

#### 1.0

First public release.

## 额外信息

 *  版本 **1.0**
 *  最后更新：**12 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 3.0 或更高版本 **
 *  已测试的最高版本为 **4.0.38**
 *  语言
 * [English (US)](https://wordpress.org/plugins/stage-wp-plugin-manager/)
 * 标签
 * [manager](https://cn.wordpress.org/plugins/tags/manager/)[plugins](https://cn.wordpress.org/plugins/tags/plugins/)
   [stage](https://cn.wordpress.org/plugins/tags/stage/)[testing](https://cn.wordpress.org/plugins/tags/testing/)
 *  [高级视图](https://cn.wordpress.org/plugins/stage-wp-plugin-manager/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  3 条 5 星评价     ](https://wordpress.org/support/plugin/stage-wp-plugin-manager/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/stage-wp-plugin-manager/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/stage-wp-plugin-manager/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/stage-wp-plugin-manager/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/stage-wp-plugin-manager/reviews/?filter=1)

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

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

## 贡献者

 *   [ Andrés Villarreal ](https://profiles.wordpress.org/andrezrv/)

## 支持

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

 [查看支持论坛](https://wordpress.org/support/plugin/stage-wp-plugin-manager/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=B7XQG5ZA36UZ4)