B-219 Sec-55 Noida, India
+918010221733

Remove duplicate meta descriptions on split WordPress posts

Use this code in theme’s functions.php


/** Add Page Number to Meta Description **/

function add_page_number_to_meta_description( $s )
{
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 < $page && $paged = $page;

$paged > 1 && $s .= ' - ' . sprintf( __( 'Page %s' ), $paged );

return $s;
}

add_filter( ‘wpseo_metadesc’, ‘add_page_number_to_meta_description’, 100, 1 );

(Visited 50 times, 1 visits today)

Leave a reply