就基本知识而言,我已经了解到有两个操作需要挂钩-wp_print_scripts
和wp_print_styles
据我所知,在将其添加到页眉之前,会调用它们。
add_action( \'wp_print_scripts\', \'my_list_scripts\' );
function my_list_scripts() {
global $wp_scripts;
$enqueued_scripts = array();
foreach( $wp_scripts->queue as $handle ) {
// do something clever
}
}
add_action( \'wp_print_styles\', \'my_list_styles\' );
function my_list_styles() {
global $wp_styles;
$enqueued_styles = array();
foreach( $wp_styles->queue as $handle ) {
// do something clever
}
}