开发者 |
mediumraredev
brugman |
---|---|
更新时间 | 2024年11月6日 02:18 |
PHP版本: | 5.5 及以上 |
WordPress版本: | 6.7 |
版权: | GPLv3 |
define( 'WP_ENVIRONMENT_TYPE', 'production' );
By default, only Administrators see the bar. You can change who sees the bar with the following snippet. This example enables the bar for Editors as well:
add_filter( 'edt_capability_check', function ( $capability ) { return 'edit_pages'; });
Instead of displaying the exact environment you've set, we show types. A type is a group of environments that roughly have the same purpose. Like local, dev, develop and development.
If you've found a common environment that we do not yet recognize as part of a type, please let us know and we'll gladly add it.
If you have a rare, custom, or localized environment name, we won't be adding those. However, you can add support for them yourself, with these snippets:
add_filter( 'edt_env_development', function ( $environments ) { $environments[] = 'daring_development'; return $environments; });
add_filter( 'edt_env_staging', function ( $environments ) { $environments[] = 'strange_staging'; return $environments; });
add_filter( 'edt_env_production', function ( $environments ) { $environments[] = 'precious_production'; return $environments; });
Please make sure the environment names are lowercased.
Perhaps, if you can convince us. Please create a GitHub issue, so we can discuss your use-case.
You can, with the snippet below.
Keep in mind that if you have a site where the end users are logged in, and see the toolbar on the frontend, you probably don't want to bother them by showing the environment info.
add_filter( 'edt_show_on_frontend', '__return_true' );
Yeah. Like with all CSS, you can override it:
#wp-admin-bar-edt-group .env-type-1 { background-color: #f09; }
Sure. You can disable our CSS with this snippet:
add_action( 'admin_enqueue_scripts', function () { wp_dequeue_style( 'edt-backend-css' ); });