Optimizing Yoast For Site Speed in WordPress

Published
Yoast Featured Image

Time

>20 minutes

Difficulty

2/10

Impact

2/10

Speed Up Yoast

Yoast is one of the most popular WordPress plugins available. It is used to manage and implement common SEO and metadata best practices and includes a lot of ancillary features associated with those disciplines.

This development and growth have meant a gross broadening of features and functionality over the years. Most sites do not use all of these features and likely see many unused features impact their overall website performance. Below, we’ll highlight some ways to speed up Yoast

Faster Alternative
RankMath

While it’s unlikely you’re reading about how to make Yoast faster because you would prefer to replace it, I did want to mention that in thousands of tests across a few thousand websites using both technologies, we’ve found that RankMath uses less bloat, enacts less features that affect performance, and allows for more flexibility in how you can offload bloat that is unneeded or unused.


Stripping out basic front-end bulk

If you don’t elect to change some of the features below inside of WordPress as we recommend, you can still add this code below to a child theme in the functions.php folder of your child theme to reduce some of the unneeded bulk on your site’s front-end loaded by Yoast.

//Remove Yoast Comments

function go_yoast() {
  if (defined('WPSEO_VERSION')){
      add_action('get_header',function (){ ob_start(function ($o){
          return preg_replace('/\n?<.*?Yoast SEO plugin.*?>/mi','',$o); }); });
      add_action('wp_head',function (){ ob_end_flush(); }, 999);
  }
}
add_action('plugins_loaded', 'go_yoast');

Simply add the above code to the bottom of the functions.php file, or wherever makes sense for your site in the child theme. If you do this inside of WordPress (via Appearance > Theme Editor > Select Child Theme) clicking update after adding the code should allow WordPress to validate the code so it doesn’t cause a critical error.


Disabling features or functions that cause bloat

Toggled On

SEO Analysis and XML sitemap are generally used by most sites with Yoast. However, if you use another tool for your sitemap, the sitemap feature should actually be toggled off.

Toggled Off

While some of these features may be used or viewed as helpful, they do add some additional bulk to the site and generally are “nice to have features” that can be replaced. That said, the author schema should not be toggled off it is currently used for rich data mark-up; as it could impact how articles with this data appear in some SERP features.