Title: get_posts category not working
Last modified: August 19, 2016

---

# get_posts category not working

 *  [oli_collins](https://wordpress.org/support/users/oli_collins/)
 * (@oli_collins)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/get_posts-category-not-working/)
 * I’m using the get_posts function to show some recents posts im using the following
   code:
    `$featuredPosts = get_posts('numberposts=4&category=112,68');` i then 
   use a foreach loop to write out what i need for each post.
 * At the moment it only seems to be showing posts from the first category rather
   then both. There are only two posts in each category so they should all be showing
   up. I have even tried having the category set to the negative of the other category
   that im not using for this section but that shows no results for it. Any ideas
   of how to show posts from multiple categories?

The topic ‘get_posts category not working’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [oli_collins](https://wordpress.org/support/users/oli_collins/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/get_posts-category-not-working/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
