groundhogg/activating

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/activating

Fires just before a Groundhogg plugin or extension is activated. Use this to run pre-activation checks in your own extension.

do_action( 'groundhogg/activating', $installer_name );

You will receive the installer slug as a string (e.g. 'groundhogg' or your extension’s slug).

Example

add_action( 'groundhogg/activating', 'my_extension_pre_activation_check' );

/**
 * Check requirements before the extension activates.
 *
 * @param string $installer_name
 *
 * @return void
 */
function my_extension_pre_activation_check( $installer_name ) {
    if ( $installer_name !== 'my-extension' ) {
        return;
    }

    if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
        wp_die( 'My Extension requires PHP 7.4 or higher.' );
    }
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.