groundhogg/deactivated

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/deactivated

Fires just after a Groundhogg plugin or extension has been deactivated. Use this to clean up options or cancel scheduled tasks.

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

You will receive the installer slug as a string.

Example

add_action( 'groundhogg/deactivated', 'my_extension_on_deactivated' );

/**
 * Clean up when the extension is deactivated.
 *
 * @param string $installer_name
 *
 * @return void
 */
function my_extension_on_deactivated( $installer_name ) {
    if ( $installer_name !== 'my-extension' ) {
        return;
    }

    wp_clear_scheduled_hook( 'my_extension_background_task' );
    delete_option( 'my_extension_version' );
}

Was this helpful?

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