I am building a theme and using Easy google fonts WordPress Plugin. I created several typography controls within Theme Customizer for Post content,Post header, Author page content, Single Post content, 404 page content...

The plugin is loading all the fonts in any page I visit. I would like to hook the style enqueue of the fonts, and return only the necessary ones, so not every selected font is called in every page, just the necessary ones.

I know how to make use of wp_dequeue_script('tt-easy-google-fonts'); I am missing a way of returning the url of the already enqueued style. When I have it then I can dequeue the script, modify the url and enqueue my new version.

So my question is how can I get the url of the already enqueued styles/scripts?

1 Answer 1


Registered styles are in the $wp_styles global, and registered scripts are in $wp_scripts. You can var_dump them to see their structure.

global $wp_scripts;
echo $wp_scripts->registered['tt-easy-google-fonts']->src;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.