When developing Plugins or Themes intended to work with ClassicPress, or adding any arbitrary code that should be fired only on ClassicPress installs, you can check if the classicpress_version()
function exists using the function_exists()
method.
This function is only registered by ClassicPress, and thus if your check returns false
, it is not a ClassicPress Install.
An example implementation:
function is_classicpress() {
if ( function_exists( 'classicpress_version' ) ) {
return true;
} else {
return false;
}
}
Then use it like so in your code:
if( true === is_classicpress() ){
// Do your CP magic.
}