Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

cestbibi on "pre_get_posts doesn't work with pretty permalinks anymore"

$
0
0

Hi,
I have this in my functions.php to limit number of posts displayed for the "retrats" category :

function hwl_home_pagesize( $query ) {
    if ( is_admin() || ! $query->is_main_query() )
        return;

    if ( is_category('retrats') ) {
        $query->set( 'posts_per_page', 1 );
        return;
    }
}
add_action( 'pre_get_posts', 'hwl_home_pagesize', 1 );

Since upgrade to 3.8 that doesn't work anymore with pretty permalinks, only in default ones (then it works)
Someone noticed that already ?


Viewing all articles
Browse latest Browse all 8245

Trending Articles