pre_get_posts
is not a filter hook, it is an action. Also you should not set orderby
to menu_order
for posts as they are not hierarchical. Set orderby
to date
instead.
function modify_query_amount_shown( $query ) {
if ( $query->is_category ) {
$query->set( 'posts_per_page', 30 );
$query->set( 'orderby', 'date' );
}
}
add_action( 'pre_get_posts', 'modify_query_amount_shown' );
Now the order of posts displayed will be consistent, regardless of the number of refreshes.