roots/wp-stage-switcher 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

roots/wp-stage-switcher

Composer 安装命令:

composer require roots/wp-stage-switcher

包简介

WordPress plugin that allows you to switch between different environments from the admin bar

关键字:

README 文档

README

Packagist Packagist Downloads Build Status Follow Roots Sponsor Roots

A WordPress plugin that allows you to switch between different environments from the admin bar.

WordPress Stage Switcher

Support us

Roots is an independent open source org, supported only by developers like you. Your sponsorship funds WP Packages and the entire Roots ecosystem, and keeps them independent. Support us by purchasing Radicle or sponsoring us on GitHub — sponsors get access to our private Discord.

Requirements

You'll need to have ENVIRONMENTS and WP_ENV defined in your WordPress config.

The ENVIRONMENTS constant must be an array of 'environment' => 'url' elements:

$envs = [
  'development' => 'http://example.dev',
  'staging'     => 'http://staging.example.com',
  'production'  => 'http://example.com'
];
Config::define('ENVIRONMENTS', $envs);

WP_ENV must be defined as the current environment:

Config::define('WP_ENV', 'development');

If you use Bedrock, WP_ENV is already defined in the config.

Installation

This plugin must be installed via Composer. Add wp-stage-switcher to your project's dependencies:

composer require roots/wp-stage-switcher

Filters

bedrock/stage_switcher_colors

Customize the background colors for each environment in the admin bar menu. Returns an array of 'environment' => 'color' pairs.

Default colors:

[
  'development' => 'firebrick',
  'staging'     => 'chocolate',
  'production'  => 'transparent',
]

Example usage:

add_filter('bedrock/stage_switcher_colors', function ($colors) {
  return [
    'development' => '#dc2626',
    'staging'     => '#ea580c',
    'production'  => '#10b981',
  ];
});

bedrock/stage_switcher_visibility

Control who can see the stage switcher in the admin bar. Defaults to is_super_admin().

Example usage:

add_filter('bedrock/stage_switcher_visibility', function ($visible) {
  return current_user_can('manage_options');
});

Community

Keep track of development and community news.

统计信息

  • 总下载量: 467.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 382
  • 点击次数: 16
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 373
  • Watchers: 24
  • Forks: 42
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-01-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固