Below you will find pages that utilize the taxonomy term “configuration”
Posts
Check if a Wordpress constant has been defined
Suppose I have configured a constant in the wp-config.php of my website:
<?php /\* Super important configuration constant \*/ define('SUPER\_IMPORTANT\_VALUE', '123e4567-e89b-12d3-a456-426614174000'); ?>Whenever you want to use this value in your website, it would be nice to know if the constant has been defined already. You’d expect to be able to do this using something like:
<?php /\* !empty does not work for a constant \*/ if (!empty(SUPER\_IMPORTANT\_VALUE)) { // Do stuff } ?