Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm new to customizing WordPress and am looking to query an array of posts within a certain category. I have a display that's showing an array of all posts from the site:

$arguments = array(
                'post_type' => 'post',
                'post_status' => 'publish',
                'paged' => $paged,
                'showposts' => $postcount
            );

Basically, I want to be able to show an array of all posts that are only in the category "Nutrition". I figured it's a 'category' argument that would be added into this array?

share|improve this question

1 Answer 1

You need to add Category Parameters to your query array.

$arguments = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'paged' => $paged,
    'showposts' => $postcount,
    'category_name'=> 'your-category-slug'
);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.