Following up on Adding arg to search results page, I want to show future posts in categories but not on the home page.
This code works:
add_action( 'pre_get_posts', function ( $q ) {
if ( !is_admin()
&& !is_feed()
&& $q->is_main_query()
) {
$q->set( 'post_status', ['publish', 'future'] );
}
});
but shows future posts on home page.
I tried adding && !is_home()
but it doesn't work - future posts no longer show anywhere.