Created
February 13, 2020 09:06
-
-
Save Matteo182/313a8432ca81720838ed703a4199c152 to your computer and use it in GitHub Desktop.
Set the number of posts on the page for all site queries in WordPress
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
// Set the number of posts on the page for all site queries | |
function tdm_filter_pre_get_posts( $query ) { | |
$query->set( 'posts_per_page',9 ); // 9 post per page | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'tdm_filter_pre_get_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment