guillermorangel
7/24/2015 - 5:08 PM

exclude post from every query with pre_get_posts

exclude post from every query with pre_get_posts

<?php

// hide blue ridge sauna from appearing on the  site
function hide_saunas( $query ) {
    // blue ridge sauna custom post type post id is 5751
    if ( $query->is_archive() && !is_admin() ) { 
    	$query->set( 'post__not_in', array(5751) ); 
    }
} add_action( 'pre_get_posts', 'hide_saunas' );

?>