My Page Speed Insights are failing due to "unused javascript". The file in question is being loaded by gstatic.com. After searching the file structure of my wordpress site, it seems that it's coming from the Types plugin. I can't figure out how to disable this to improve my page speed. I'd be willing to use a different recaptcha plugin that's not built into Types that will give me more control over which pages it's loaded on as right now it's loaded globally, even on non "contact us" pages.
Hello and thank you for contacting the Toolset support.
Currently, there is no built-in way in WordPress or Toolset to achieve this. You will need to use custom code to change how the script is being added. For example, the following code will add the "defer" attribute to the script tag:
add_filter( 'clean_url', function( $url )
{
if ( FALSE === strpos( $url, 'www.google.com/recaptcha/api.js' ) )
{ // not our file
return $url;
}
// Must be a ', not "!
return "$url' defer='defer";
}, 11, 1 );