Handy Code Snippets for the Yoast SEO Plugin on your Child Sites

Handy Code Snippets for the Yoast SEO Plugin

Heads up: This page may include affiliate links. Read the full disclosure.

Yoast SEO is a well-known, easy-to-use plugin for SEO. Yoast SEO has a number of code snippets that can be saved to limit or disable specific functions.

MainWP has an amazing extension for code snippets, which easily allows you to apply code snippets to your child sites.

We have taken the time to save out a number of handy code snippets for Yoast SEO into the code snippets GitHub repo.

A common bug in Yoast SEO is when you update the plugin, it can redirect to the about page and tour page. You can use this code snippet so this does not happen on your child sites.

Yoast SEO has a function to use transients to cache the sitemap. This function is disabled by default, but you can enable it using this code snippet.

Yoast SEO has built-in schema for JSON-LD in the schema output it will include the author on content. If you need to disable author from the schema, use this code snippet to do so.

Yoast SEO will output search schema in the header of the site it is installed on. You can disable it from being output in the header by using this code snippet.

If you need to disable images from being output in the sitemap XML that is generated by Yoast SEO, you can use this code snippet.

MainWP also has a solid extension for applying bulk settings to all connected child sites. Yoast SEO plugin, by default, will add a menu to the admin bar. If you need to disable that admin bar, you can follow this KB post. You can also apply this bulk setting, which will set that change. The bulk setting change is based on the default settings in general for Yoast SEO you can also easily enough create your own bulk settings for Yoast SEO, based on your needs.

There are a number of other code snippets for the Yoast SEO that are in the GitHub repo for MainWP code snippets. Please take the time to check them out.

Looking for something?

Privacy laws apply to businesses that collect personal information. Since no personal information is collected by the MainWP plugins, no privacy laws apply to the MainWP plugins. This includes GDPR, UK DPA 2018, PIPEDA, Australia Privacy Act 1988, LGPD, PIPL, and other privacy laws.
Donata Stroink-Skillrud
Donata Stroink-Skillrud
President of Agency Attorneys

Your Download Is Just One Click Away

…or just download the plugin.

By entering your email, you agree to our Terms of Service and Privacy Policy.