Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save khanrn/569e7fb58369e6a803ed481961c45618 to your computer and use it in GitHub Desktop.

Select an option

Save khanrn/569e7fb58369e6a803ed481961c45618 to your computer and use it in GitHub Desktop.
This function helps to understand scripts loading sequence for 'WooCommerce Admin' plugin
/**
* This function helps to understand scripts loading sequence for 'WooCommerce Admin' plugin
* @author Khan Mohammad R. <codemascot@hotmail.com>
* @return void
*/
function codemascot_get_scripts_on_loading_sequence_for_wc_admin() {
// JS Scripts part
global $wp_scripts;
$t = [];
$i = 1;
foreach ( $wp_scripts->registered as $k => $v ) {
if ( false === strpos( $v->src, 'woocommerce-admin' ) ) {
continue;
}
$t[ $i . '-' . $k ] = $v;
$i++;
}
print_r( $t );
// PHP scripts part
$t = [];
$i = 1;
foreach ( get_included_files() as $k => $v ) {
if ( false === strpos( $v, 'woocommerce-admin' ) ) {
continue;
}
$t[ $i . '-' . $k ] = $v;
$i++;
}
print_r( $t );
}
add_action( 'admin_footer', 'codemascot_get_scripts_on_loading_sequence_for_wc_admin' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment