By doing the !defined()
check you allow earlier code to define that constant before you. This could be useful, for example, if a user is allowed to define its own values for some constants in a file like wp-config.php
.
As for code readability, you may consider using the following one-liner, although you could put a regular if
on a single line as well.
defined('XYZABC_PLUGIN_BASENAME') or define('XYZABC_PLUGIN_BASENAME', 'your_value');