0

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?

0

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'
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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