How to change title tags on paginated posts?

I’ve created many post with multiple pages with the nextpage-tag. The problem is that these show up as errors in “Google Webmaster Tools” because of duplicate title tags and meta descriptions.

The urls are like this:

http://mypage.com/mypost/
http://mypage.com/mypost/2
http://mypage.com/mypost/3

all of which have the same title and meta tags.

Is it somehow possible to include the page number to the meta tags?

I’m using the “WP SEO” which surprisingly doesn’t have this feature.

Solutions Collecting From Web of "How to change title tags on paginated posts?"

Is “WP SEO” = “WordPress SEO by Yoast”? If so, the plugin has some tags for you:

  • %%page%% – Replaced with the current page number (i.e. page 2 of 4)
  • %%pagetotal%% – Replaced with the current page total
  • %%pagenumber%% – Replaced with the current page number

Just look at the bottom of the page wp-admin/admin.php?page=wpseo_titles, you’ll see. Just try it.

You may just add these lines to your header.php under title tag:

<?php if ( $paged < 2 ) { } else { echo (' Page '); echo ($paged);} ?>

Try using the $page global to filter wp_title:

<?php
function wpse24661_filter_wp_title( $title, $separator ) {
    // Globalize $page
    global $page;

    // Determine if current post is paginated
    // and if we're on a page other than Page 1
    if ( $page >= 2 ) {
        // Append $separator Page #
        $title .= ' ' . $separator . ' ' . 'Page ' . $page;
    }    
    // Return filtered $title
    return $title;
}
add_filter( 'wp_title', 'wpse24661_filter_wp_title', 10, 2 );
?>

Above answer is not working due to global variable issue, we have to use ‘$paged’ instead of ‘$page’.
Following is updated solution

function wpse24661_filter_wp_title( $title, $separator ) {
    // Globalize $page
    global $paged;

    // Determine if current post is paginated
    // and if we're on a page other than Page 1
    if ( $paged >= 2 ) {
        // Append $separator Page #
        $title .= ' ' . $separator . ' ' . 'Page ' . $paged;
    }    
    // Return filtered $title
    // echo $title;die;
    return $title;
}
add_filter( 'wp_title', 'wpse24661_filter_wp_title', 101, 2 );