由于全局变量问题,上述答案无效,我们必须使用“$paged”而不是“$page”。以下是更新的解决方案
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 );