Skip to content

Instantly share code, notes, and snippets.

@stellarcowboy
Last active December 11, 2015 08:38
Show Gist options
  • Save stellarcowboy/4574479 to your computer and use it in GitHub Desktop.
Save stellarcowboy/4574479 to your computer and use it in GitHub Desktop.
WordPress: Fix pagination for static homepage with augmented query
// Fix pagination for static homepage with augmented query
function modify_query($query) {
if($query->is_main_query()) {
if (! get_query_var('paged')) {
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$query->set('paged',$paged);
}
}
}
add_action( 'pre_get_posts', 'modify_query' );
@stellarcowboy
Copy link
Author

Add this to functions.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment