Last active
December 11, 2015 08:38
-
-
Save stellarcowboy/4574479 to your computer and use it in GitHub Desktop.
WordPress: Fix pagination for static homepage with augmented query
This file contains hidden or 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
// 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to functions.php