wp_query “private” entries… plus only specific category
-
Ok, so I’ve been working on this site and I want the front page to post the most recent post. The majority of the posts in that I wanted to post are “private”. I’m currently using get_posts to do this, for some reason, get_posts can override the fact that posts are private by default and see them. Here is where I run into a problem-
1) get_posts cannot pass a category restriction (I have one in there, it does nothing). So i will just pull up the most recent post, regardless of the cat.
2) wp_query can do more, but I can’t get it to search the “private” posts, it doesn’t see the category its in either because all the posts in that cat are private.What I need (to restate): Code that will search through all my posts, public and private, pull X number of posts from a Y only category and publish it.
This is code I currently have:
<?php $posts = get_posts( "category=interviews&numberposts=1" ); ?> <?php if( $posts ) : ?> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?> <div class="post"> <?php echo $post->post_excerpt; ?></div> <?php endforeach; ?> <?php endif; ?>
Any help would be awesome.
- The topic ‘wp_query “private” entries… plus only specific category’ is closed to new replies.