admin管理员组

文章数量:1426195

Is there any way to list which scripts and styles have been enqueued, while within wp-admin?

For example this code works, but only if you are on the frontend. How could I get the same list while staying in wp-admin?

function dc_list_scripts() {
    global $wp_scripts;
    $enqueued_scripts = array();
    foreach ( $wp_scripts->queue as $handle ) {
            $enqueued_scripts[ $handle ]['handle'] = $wp_scripts->registered[ $handle ]->handle;
            $enqueued_scripts[ $handle ]['src'] = $wp_scripts->registered[ $handle ]->src;
    }
    print_r( $enqueued_scripts );
}
add_action( 'wp_print_scripts', 'dc_list_scripts' );

If I run the above code in wp-admin then I get a list of scripts and styles enqueued within wp-admin. That's not what I want, I need to know which resources are enqueued for the frontend.

本文标签: wp adminList All Enqueued Scripts and Styles