Get only enqueued styles and scripts of the current theme
The first argument of preg_match is supposed to be a pattern, not a string, so it’s probably not comparing the way you expect. Use strpos instead: function wpse_275760_theme_scripts() { global $wp_scripts; $stylesheet_uri = get_stylesheet_directory_uri(); foreach( $wp_scripts->queue as $handle ) { $obj = $wp_scripts->registered[$handle]; $obj_handle = $obj->handle; $obj_uri = $obj->src; if ( strpos( $obj_uri, $stylesheet_uri ) … Read more