Useful Yoast Hacks

I use Yoast SEO on a daily basis. Here are some hacks that I use. Add this in your theme’s functions.php

1) Disable Yoast JSON-LD

add_filter( 'wpseo_json_ld_output', '__return_false' );

2) Noindex paginated pages

Since the version 7.0 Yoast SEO started paginated pages indexation by default. Meaning search engines will index your paginated pages. For example: /page/2/Β or /page/3/Β etc pages will be indexed by search engines and will show up on SERP by default. Previously you could disable it from the settings but that is no longer the case.

Some like it, some don’t. Personally I don’t like this at all because it hurts SEO of your actual posts. Fortunately you can disable it by adding some few line of codes.

The following code will automatically add noindex tag on all the paginated pages, hence the search engines are not going to index them. If they already indexed them then they’re gonna noindex them within a few days.

// noindex tag for paginated pages
add_filter( 'wpseo_robots', function( $string ) {
    if ( is_paged() )
		return 'noindex, follow';
    else
		return $string;
});

Once you added them you can check if the code is working by looking into the source code of a paginated pages. ✌

2 thoughts on “Useful Yoast Hacks”

Share your thoughts by leaving a comment below.