If you have the category ID you can use the category__in
parameter eg:
<?php $custom_posts->query(array('category__in' =>array(1,2,3))); ?>
Related Posts:
- How to return results of a get_posts() in explicitly defined order
- Modify main WordPress loop with a parse_query filter
- How should I intercept the main query and inject custom join / order by / group by criteria
- Dynamically excluding current page id
- How to order results by date and meta key?
- Static Front-Page Excerpts
- Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?
- query_posts() ALWAYS displays something?
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- Custom loops, sticky posts, and pagination nightmare
- Filter Loop by Custom Field Value
- Modify loop but keep the original query, what am I doing wrong?
- When to use WordPress loop or Foreach loop?
- Post per page not working if no category specified
- Calling Posts from Specified Cat
- Most Effective Method? Exclude Category and Number of Posts Per Page
- How do I query based on the modified date?
- Script that gets the first tag of post and query all other posts with the same tag
- Modify main loop query for paged and meta key
- Create a Loop with Posts Ordered by Most Recent Comments
- query_posts and sub pages?
- The_content display a different content from a previous loop
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- Including post data in a sidebar occurring outside of and before the Loop
- Multiple loops with / without sticky posts and different post limits
- Why query_posts() isn’t marked as deprecated?
- How to get posts published between a date and today?
- how to query posts by category and tag?
- How do I query by post format in WordPress 3.1
- How to set posts per page using WP_Query()
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- Custom Post Type “Event”: chronological list of recurring events
- Order by meta value, pro first, then free
- How to create an attachments archive with working pagination?
- query_posts and pagination, still stuck after much research
- Query posts by taxonomy term name
- how could I get the pagination as I want to when query posts using get_posts function
- Counter code for paginated category pages in wordpress
- Author List page: Exclude based on last post date
- Replace query_posts with pre_get_posts
- query_posts sort in multiple directions
- Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)
- Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output
- Query for posts in 2 taxonomies
- Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook
- exclude ids through post__not_in
- Exclude category from loop not working
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- Integrating post archive wtih another source and preserving date ordering
- Order posts using a custom array
- WordPress query_posts and orderby page order
- IF.. post meta show… Conditional Tag Help…?
- Show Only Posts Owned By Logged In User + my post
- Custom MySQL Query with logic
- Query last updated posts (posts updated in the last 24 hours)
- order posts by meta value on posts page
- Query_post($args)
- Show a Category X’s custom post type on Category X archive page?
- trouble with query to fetch next and previous posts
- Some doubts about how the main query and the custom query works in this custom theme?
- How do I make query use exact post title
- Simple custom post query for all the posts or many of them not working
- Hook to return true when the_post() is used in a custom while loop
- My post repeats itself on the second page [closed]
- Exclude first post (sticky or not) from the loop using query_posts()
- Proper syntax to add boolean in array()
- using query_posts to pull posts out of a category in a while loop. Getting odd echo
- Echo a numerical value in query_posts
- why to use query_posts() in custom page?
- Query posts to get all but the most recent post
- Always using the same ARRAY on different querys
- Include current post into loop
- How to provide meta_key array to wp_query?
- How to only publish posts with image in it
- How do I use pagination in WordPress?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Does WordPress run a post query when a page is invoked?
- Using functions.php to include code that’s processed inline
- Multiple posts/pages in one page?
- query_posts clarification needed
- Paginate pages with dynamic query
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Determine if ID is page or post and query the ID
- How to check a list or feed of all posts under a category and tag?
- How do I add a timezone offset to this query?
- query_posts thumbnail condition
- Show posts from specific roles
- Latest 5 post excerpts from 5 different authors in Sidebar
- Custom Post Types Not Showing Up In query_posts Result
- Help with query_posts function
- Is there anyway I can call the year once?
- How to show post views shortcode data for each post on Posts List Page?
- Pull new posts using feed
- Div Missing In Custom Loop Query
- query_posts() with multiple meta data comparisons
- get_posts and wp_autop (remove filter)
- Multiple loop for “featured” items returns wrong posts
- How to can I search range of products using between
- show custom post’s post in two different divs [duplicate]