• netvision

    (@netvision)


    Hello, I checked many examples but couldn’t get this working.
    Here is the code I’m using:

    function exclude_some_posts( $query ) {
    	if ( $query->is_main_query() ) {
    	   $query->set('post__not_in', array(1));
    	}}
    add_action( 'pre_get_posts', 'exclude_some_posts' );
  • The topic ‘How can I use "post__not_in" with pre_get_posts?’ is closed to new replies.