Add page number to Yoast meta description and page titles/descriptions to avoid duplication

if ( ! function_exists( 'ujp_add_page_number' ) )
{
function ujp_add_page_number( $s )
{
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 1 && $s .= ' - ' . sprintf( __( 'Page %s' ), $paged );
return $s;
}

add_filter( 'wpseo_metadesc', 'ujp_add_page_number', 100, 1 );
add_filter( 'wpseo_title', 'ujp_add_page_number', 100, 1 );
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.