I would like to remove the following two script and one style tags. They appear to be added by the Yoast SEO plugin, but looking through their plugin files yields nothing promising. Does anyone know where these are enqueued or another way to remove them?

<!-- / Yoast WordPress SEO plugin. -->
<script type="text/javascript" src="http://barrjoneslegal.com/wp-includes/js/jquery/jquery.js?ver=1.11.1"></script>
<script type="text/javascript" src="http://barrjoneslegal.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1"></script>
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

(For the inevitable "why" comment, there's no reason to load these as I don't have any other scripts on the front-end site requiring them.)



How this line (9th) is created within your theme code?

<script type="text/javascript" src="/wp-content/themes/blankslate/js/jquery-1.11.1.min.js"></script>

If it is hard-coded in header.php, then I would recommend to remove it. Scripts should be enqueued instead of hard-coding them.

Next, you can de-register jquery.migrate script with the following code added to functions.php:

 * Remove jQuery migrate script
add_filter( 'wp_default_scripts', 'barrjoneslegal_remove_jquery_migrate' );
function barrjoneslegal_remove_jquery_migrate( &$scripts ) {
  if ( ! is_admin() ) :
    $scripts->remove( 'jquery' );
    $scripts->add( 'jquery', false, array( 'jquery-core' ), false );

Now you have the minimal amount of scripts on the front end. You need jQuery itself, because it is used by the following script (by the way, it should be enqueued as well):

<script type="text/javascript" src="/wp-content/themes/blankslate/js/site.js"></script>

The underneath line isn't relative to Yoast but WP Bakery (formerly Visual Composer):

<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

you can put this into the functions.php of your child theme in order to remove it from the head of your HTML page:

/* Deactivate adding of extra inline CSS in <head> by WP Bakery for comment widget purposes */

add_filter( 'show_recent_comments_widget_style', '__return_false' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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