Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreiglingeanu/621acbf0552060b672ddc2cb88b5e1b4 to your computer and use it in GitHub Desktop.
Save andreiglingeanu/621acbf0552060b672ddc2cb88b5e1b4 to your computer and use it in GitHub Desktop.
<?php
add_action(
'template_redirect',
function () {
if (
is_singular()
||
is_single()
) {
global $wp_query;
$page = (int)$wp_query->get('page');
if ($page > 1) {
$query->set('page', 1);
$query->set('paged', $page);
}
remove_action('template_redirect', 'redirect_canonical');
}
},
0
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment