Created
August 16, 2024 20:14
-
-
Save wpexplorer/670430ca1b44e77d92f25b2a58280223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'redirect_canonical', function( $redirect_url ) { | |
$posts_with_pagination = [ 1, 2, 3, 4 ]; // array of posts that have custom pagination. | |
if ( is_paged() && in_array( get_the_ID(), $posts_with_pagination ) ) { | |
return false; | |
} | |
return $redirect_url; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example shows how to allow standard pagination on singular posts for specific posts. If you want to target a whole post type or other, please modify accordingly.