How To Hide CPT Post IDs From Their Archive?
-
I am trying to hide two custom post type Post IDs from their own archive only. I still want them to appear in feeds, search and on the homepage, etc.
I currently use this code for other functions and was trying to modify it with no luck. I cannot find anything on this, only how to hide posts. I know I am missing something here. Thanks so much in advance!
// Hide Posts Pages from RSS feeds function exclude_single_posts($query) { if (($query->is_home() || $query->is_archive() || $query->is_feed() || $query->is_search()) && $query->is_main_query()) { $query->set('post__not_in', array(52428,52432,52426,52436,52434,52430,52845,52424,52438,13363,45989,54116,38540)); } } add_action('pre_get_posts', 'exclude_single_posts');
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘How To Hide CPT Post IDs From Their Archive?’ is closed to new replies.