Use get_posts
with a taxonomy query:
$prefs = array(array('14','15'));
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'custom_tax_name',
'terms' => $prefs[0],
'operator' => 'IN'
)
)
);
$postslist = get_posts( $args );
Related Posts:
- Retrieving 3 latest post from each of 5 different custom post types
- Quickest way to get last or oldest post date – WP Query
- Stuck in Order by more then one
- Query Multiple Custom Posts by Custom Fields
- Group by custom field value (start and end times)
- Get posts by category name
- How to properly use Categories with Custom Post Types
- date_query empty results with custom post type
- Query a custom taxonomy in a function to create an csv file
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Get post from Category by Priority
- How can you use a page for a custom post type?
- This wp_query will not return any posts and only seems to work with post_status inherit?
- Query posts by a type and another type only if post is in specific category
- shortcode for recent custom type post
- How do I correctly query posts from a post ID?
- Display all posts in a custom post type, grouped by a custom taxonomy
- Query by post title
- Get post with multiple meta keys and value
- Get posts for custom post type with WP_Query
- WP_Query() show posts that end later than today
- How to check if a WP_Query has data
- Sorting a query by custom field date
- Enforcing canonical URLs with multiple custom post types
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- Get latest 4 post on a custom post filtered by category
- how to group custom post type posts by custom taxonomy terms
- How to sort CPT by custom meta value (date), and return posts month by month
- Wp-query causing problems with the_content();
- wp_query and comment_parent – select only posts with top level comments
- Multiple Archive Pages for Custom Post Types AND Taxonomies
- List all custom post type posts from a given category?
- Getting a custom post type image using ‘get_post_custom’
- Exclude current post when getting related post on custom post type and taxonomy
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Ordering Custom Post Types with WP_Query
- Filter posts with meta_query NOT IN where value has multiple values
- How to query different post types in specific order?
- Loop on front-page.php
- is_main_query() not working for WP REST API
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Loop through Custom Post Type, and then show children within each iteration
- Unable to retrieve any posts of CPT in wp-admin
- Linking to the most recent post in a Custom Post Type
- How to make sure content doesn’t display if selection is empty
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Creating a navigation menu of all posts of a custom post type and their children posts?
- Wp_query: sort by PHP variable
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Crafting WP_Query array, sort by date
- forming WP_Query for posts of all post types but from specific categories
- How can I get the number of custom post type posts that have a specific attachment image set?
- Including metaboxes from custom post types in global search — continued
- Custom Widget WP_Query problem
- Order posts by 2 custom fields and if one custom field is zero orderby another custom field
- Detect inside a custom query the kind of post type to assign custom classes
- Reworking function for counting custom post type posts count
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Custon Content within WordPress Loop
- WP Query ‘posts_per_page’
- get_pagination not working on a custom post type query (using WP_Query)
- How to Make infinite loop of post
- WP_Query with custom post type ID
- get_posts seems to be skipping the last Post
- Query all post and CPT from 2 specific taxonomies AND by ACF custom field
- WP_Query order by two values
- How to Query in WordPress which shows Alphabetic Posts?
- postsperpage value not being applied
- Create query for both custom post type and category
- wp_dropdown_pages with tax_query clause
- Cache issue with WP_Query and custom field filtering
- Post Type => Any conundrum
- Display featured posts for a custom post type by taxonomy
- What is the most efficient way to execute recursive complex queries?
- conditional filter
- Alike Shortcode using in Custom Shortcode
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- display post count in archive page that have relation with another taxonomy term
- How can I sort the results of a REST API response by the title of a connected custom post type?
- Query when is one or several values
- Use WP_query to match post types based on custom field values
- Problems in paginate_links with custom query loop and MB-Relationships
- Post Filtered by Custom Field Value
- Show specific posts with WP_Query using ACF Post object
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Imported Content Doesnt Show Up On Frontend
- Loop carousel slider in wordpress
- Manually build WP_Query
- Loop with Custom Post Type and Taxonomies
- New WP_Query not isolating custom post types on front-page template
- How to load more custom type posts through AJAX & LOAD MORE POSTS button
- Pagination always adding “Next” link when results come from Custom Post Type WP_query
- 404 on Pages for Custom Post Type & Query_Posts
- Pagination not working on homepage
- How to query custom post then display sections by meta value
- How to manage wordpress knowledge base/wiki/posts collections
- Is it possible to make is_category() recursive?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- How do I get parameters from the URL?