How to Remove All Yoast HTML Comments From Page source?

Let’s remove all Yoast HTML comments from WordPress page or post source. Before that, I’m going to explain why you should remove it.

Though HTML comments are not visible but these are a part of DOM tree and increase the number of DOM elements. Too many HTML comments can increase the overall size of any page.

Keeping a few HTML comments may not affect your page speed. But if you have too many HTML comments, then definitely it will decrease your webpage speed. 

If you are a basic WordPress user, then HTML comments are useless to you. It’s better to get rid of all HTML comments. 

To remove all Yoast HTML comments you need to copy and paste the following code inside your function.php file. 

Search the function.php file inside your active Theme’s root directory. 

				
					// Remove Yoast SEO generator tag
add_filter('wpseo_debug_markers', '__return_false');
				
			

It’s easy to remove all Yoast HTML comments via WP Adminify plugin. You don’t need to work on coding if you have installed WP Adminify in your WordPress website.

After installation, you will see WP Adminify menu item, inside your dashboard side menubar. You can take a look at this WP Adminify Tweaks option for better understanding. Click on it and navigate to tweaks > Head. Search for Remove All Yoast HTML Comments and enable it.

Remove all yoast HTML comments
August 27, 2021
Head Tips and Tutorials
Was this article helpful?

© 2021 - Adminify | All rights reserved

WP Adminfy accepted payment methods