wc_maybe_define_constant

Define a constant if it is not already defined.

Description

wc_maybe_define_constant( (string) $name, (string) $value ); 

Parameters (2)

0. $name (string)
The name.
1. $value (string)
The value.

Usage

  1. if ( !function_exists( 'wc_maybe_define_constant' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4. // The name. 
  5. $name = ''; 
  6.  
  7. // The value. 
  8. $value = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_maybe_define_constant($name, $value); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_maybe_define_constant( $name, $value ) { 
  2. if ( ! defined( $name ) ) { 
  3. define( $name, $value );