ceu_define_constants_after
Fires after core constants are defined, allowing for late-stage constant modifications or initializations.
add_action( 'ceu_define_constants_after', $callback, 10, 1 );
Description
Fires after core plugin constants have been defined. Use this hook to add custom constants or perform actions that rely on the plugin's base configuration being established. This is an internal hook used by the plugin's core.
Usage
add_action( 'ceu_define_constants_after', 'your_function_name', 10, 1 );
Examples
// Example: Add a custom constant after core constants are defined.
add_action( 'ceu_define_constants_after', 'my_ceu_define_custom_constant', 10, 0 );
/**
* Define a custom constant for our plugin after core constants are set.
* This is a realistic scenario where a plugin might want to define its own
* unique identifiers or settings after the main plugin configuration.
*/
function my_ceu_define_custom_constant() {
// Define a custom constant for easier access to a specific feature or setting.
// Replace 'MY_CEU_FEATURE_ENABLED' with a descriptive name for your constant.
// Replace 'true' with the actual value you want to assign (e.g., 'some_path', 1, etc.).
if ( ! defined( 'MY_CEU_FEATURE_ENABLED' ) ) {
define( 'MY_CEU_FEATURE_ENABLED', true );
}
// Example of using another constant that might have been defined by the hook's source.
// This assumes that $prefix would be available if it were passed or accessible globally.
// In a real scenario, you'd likely get such values from a global variable or a class property if this was part of a class.
// For demonstration, let's imagine a scenario where we want to check if the plugin prefix is something specific.
// If $prefix was accessible, you might do something like this:
/*
if ( defined( 'YOUR_PLUGIN_PREFIX' ) && YOUR_PLUGIN_PREFIX === 'my_ceu_' ) {
// Perform some action if the prefix matches
error_log('The Uncanny CEU plugin prefix is set to "my_ceu_".');
}
*/
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/config.php:62
public function configure_plugin_before_boot( $plugin_name, $prefix, $version, $file, $debug ) {
$this->define_constants( $plugin_name, $prefix, $version, $file, $debug );
do_action( 'ceu_define_constants_after' );
register_activation_hook( Utilities::get_plugin_file(), array(
$this,
'activation',
) );
register_deactivation_hook( Utilities::get_plugin_file(), array(
$this,
'deactivation',
) );
add_action( 'admin_init', array(
$this,
'uncanny_ceu_plugin_redirect',
) );
do_action( 'ceu_config_setup_after' );
}