search ]

Modify Title Tag on Paginated Pages

If you look at the source of paginated pages on your blog, you will see they all share the same title tag. To avoid duplicate <title> tags, add the page number to the end of the tag. You can do this (assuming you use WordPress SEO by Yoast) by adding the following code to your functions.php file:

function change_yoast_title($title) {
	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
	if ( is_paged() ) {
		return $title . ' - Page ' . $paged;
	}
	else {
		return $title;
	}
}
add_filter('wpseo_title','change_yoast_title');
Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo