Skip to content

Instantly share code, notes, and snippets.

@mihdan
Created August 19, 2021 07:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mihdan/de9ed614cb17769f99bdc7a08f85e320 to your computer and use it in GitHub Desktop.
Save mihdan/de9ed614cb17769f99bdc7a08f85e320 to your computer and use it in GitHub Desktop.
<?php
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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment