Menu Close

Fix the pagination URL canonical problem – WordPress

Codeamend
Code Snippet to fix the pagination URL canonical Problem. Setup canonical URL for WordPress blogs, products(WooCommerce) and its category paginations to solve the SEO errors.
function return_canon () {
    $canon_page = get_pagenum_link(1);
    return $canon_page;
}

function canon_paged() {
    if (is_paged()) {
        add_filter( 'wpseo_canonical', 'return_canon' );
    }
}
add_filter('wpseo_head','canon_paged'); 
Posted in WordPress

You can also read...