groundhogg/scripts/after_register_admin_scripts

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/scripts/after_register_admin_scripts

Fires after Groundhogg registers its admin JavaScript files. Use this to register custom admin scripts that depend on Groundhogg admin scripts.

do_action( 'groundhogg/scripts/after_register_admin_scripts', $script_debug, $dot_min );

You will receive a boolean indicating whether script debugging is enabled, and the minification suffix string ('' or '.min').

Example

add_action( 'groundhogg/scripts/after_register_admin_scripts', 'my_extension_register_admin_scripts', 10, 2 );

/**
 * Register a custom admin script that depends on Groundhogg.
 *
 * @param bool   $script_debug
 * @param string $dot_min
 *
 * @return void
 */
function my_extension_register_admin_scripts( $script_debug, $dot_min ) {
    wp_register_script(
        'my-extension-admin',
        MY_EXTENSION_URL . "assets/js/admin{$dot_min}.js",
        [ 'groundhogg-admin' ],
        MY_EXTENSION_VERSION,
        true
    );
}

Was this helpful?

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