WordPress: Check enqueued scripts and styles

The following snippets allow checking which scripts and styles are loaded on your pages and posts.

<?php
// Check enqueued scripts
add_action( 'wp_enqueue_scripts', 'nl_check_enqueued_scripts', 99999 );
function nl_check_enqueued_scripts() {
	global $wp_scripts;
	var_dump( $wp_scripts );
}
// Check enqueued styles
add_action( 'wp_enqueue_scripts', 'nl_check_enqueued_styles', 99999 );
function nl_check_enqueued_styles() {
	global $wp_styles;
	var_dump( $wp_styles );
}

Exclude node_modules and vendor from theme check plugin

While I created countless themes, I’m currently creating my first theme for the WordPress.org theme repo. To ensure a smooth reviewing process, I’m using the plugin Theme Check as mentioned in the theme review handbook.

(more…)