Fires just after a Groundhogg plugin or extension has been activated and its installer has run. Use this to set up default options or seed data on first activation.
do_action( 'groundhogg/activated', $installer_name );
You will receive the installer slug as a string.
Example
add_action( 'groundhogg/activated', 'my_extension_on_activated' );
/**
* Seed default settings when the extension is activated.
*
* @param string $installer_name
*
* @return void
*/
function my_extension_on_activated( $installer_name ) {
if ( $installer_name !== 'my-extension' ) {
return;
}
add_option( 'my_extension_version', MY_EXTENSION_VERSION );
add_option( 'my_extension_installed', time() );
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
