Debug Bar Constants adds three new panels to the Debug Bar that display the defined WP and PHP constants for the current request.
Debug Bar Constants adds three new panels to the Debug Bar that display the defined constants available to you as a developer for the current request:
This plugin requires the Debug Bar plugin to be installed and activated.
Also note that this plugin should be used solely for debugging and/or in a development environment and is not intended for use on a production site.
If you like this plugin, please rate and/or review it. If you have ideas on how to make the plugin even better or if you have found any bugs, please report these in the Support Forum or in the GitHub repository.
/wp-content/plugins/
directory. Alternatively, you can install directly from the Plugin directory within your WordPress Install.Don’t use this plugin on a live site. This plugin is only intended to be used for development purposes.
/wp-content/plugins/
directory. Alternatively, you can install directly from the Plugin directory within your WordPress Install.Don’t use this plugin on a live site. This plugin is only intended to be used for development purposes.
PLEASE DON’T! Amongst the defined constants are your database credentials, so you really do not want to do this.
This plugin is only meant to be used for development purposes.
A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script. A constant is case-sensitive by default. By convention, constant identifiers are always uppercase.
Like super globals, the scope of a constant is global. You can access constants anywhere in your script without regard to scope. For more information on scope, read the manual section on variable scope.
Congratulations! Sounds like you’re practicing lean programming (or something is going wrong… 😉 ).
The constants you see are the ones available in the current request. If you define constants in a conditionally included file – for instance you only include the file when on a certain page -, these constants will not be available if the conditions have not been met.
See the previous question.
It is possible to define constant values on a per-class basis remaining the same and unchangeable. Constants differ from normal variables in that you don’t use the $ symbol to declare or use them.
The value must be a constant expression, not (for example) a variable, a property, a result of a mathematical operation, or a function call.
It’s good coding practice to avoid littering the global namespace with your own variables and constants. This is a good way to avoid this.
If your plugin/theme interacts with other plugins and/or themes, you may want to use their constants.
Example: A plugin might have their version number saved as a class constant (good practice!). On your part, your plugin may have been set up to only work if the related plugin has been upgraded to version x. In that case, you may want to check other plugins version number before your plugin interacts with it.
Don’t forget to always check whether the class constant exists before you use it! It may not be available on all pages and surely not on all WP installs.
if( defined( 'class_name::constant_name' ) ) { // Your code here }
Easy: It’s bad practise to name your class the same as one of the PHP native/extension classes.
In general, when you’re developing a plugin/theme, you are developing for an unknown group of other people with unknown server configurations – including which extensions are(n’t) installed -, so you should always make sure that your class will not interfere with any of the PHP native/extension classes.
I’ve tried to exclude all PHP classes from this list, however, I might have missed some. Also some new extensions and/or classes may have been introduced in PHP since the last version of this plugin was released.
Please let me know which one(s) you found and I’ll add it/them to the exclusion list.
Have you read what it says in the beautifully red bar at the top of your plugins page ? As it says there, the Debug Bar plugin needs to be active for this plugin to work. If the Debug Bar plugin is not active, this plugin will automatically de-activate itself.
Release date: 2018-01-22
Release date: 2017-07-10
Release date: 2016-04-15
Release date: 2016-04-12
must-use
plugins directory.Release date: 2016-01-13
Release date: 2016-01-10
Release date: 2015-12-07
Release date: 2015-12-05
Release date: 2015-04-18
Release date: 2014-09-05
Release date: 2013-12-02
Release date: 2013-11-30
Release date: 2013-10-01
Release date: 2013-05-27
Release date: 2013-05-05
Release date: 2013-04-30 / not released
Release date: 2013-04-28