Exclude posts from WP_Query?
I’m trying to fetch a list of posts on a page but exclude some specific id’s from the results, so I’ve tried
$my_query = new WP_Query('showposts=10&exclude=1,24,312')
but the resulting object still contains the excluded posts. I’ve also tried:
$my_query = new WP_Query('showposts=10&p=-1,-24,-312')
to no avail. Can anybody suggest the proper way to do this?
For example … I want to fetch the 10 most recent posts in the list except for the posts with an id’s of 1,24,312.
- The topic ‘Exclude posts from WP_Query?’ is closed to new replies.