Excluding a category using get_posts
-
I want to list the 5 most recent posts in all categories except category 4. If I do this:
<?php $posts = get_posts('numberposts=5&exclude=4'); foreach($posts as $post) : ?>
… that simply excludes the post with id=4.
I thought “exclude” was supposed to exclude categories, not posts. Maybe this is a conflict caused by a plugin? Or is there another way?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Excluding a category using get_posts’ is closed to new replies.