I’m assuming ‘news_category’ is a custom taxonomy; if not, and if you have simply created a new post category called ‘news_category’, it will only work if you add support to your custom post type. Be aware though that this will add complexities to your feeds and queries, as well as affecting how category posts show in the admin. It is most straightforward to do this with a custom taxonomy if you can.
Onto solving this using a custom taxonomy:
You need to add a taxonomy query to your arguments, so WP knows where to look for that new term.
$news = get_posts(
array(
'post_type' => 'news',
'tax_query' => array(
array(
'taxonomy' => 'nameofyourcustomtaxonomy',
'field' => 'slug',
'terms' => 'news_category',
),
)
)
);
Related Posts:
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- How to get only one category of custom post type?
- How to query custom post type by term?
- How to get the intersection of two terms both from different custom taxonomies
- custom hierarchical taxonomy and custom post type list contains surplus posts
- Get posts by category name
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
- Query a custom taxonomy in a function to create an csv file
- week days sorting based on starting day
- Error get_posts with Custom Taxonomy and OR relation
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- WordPress get all post with like in terms [duplicate]
- Decrement term in for each
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- Create a hierarchical list of posts that’s grouped and nested by category
- Taxonomy, Terms, and Template Files
- Exclude a category from WP_Query
- Custom Post Types not showing on Custom Taxonomy archive page
- custom post type or taxonomy
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Changing the priority of a custom taxonomy’s metabox
- How to list all categories and tags in a page?
- WordPress custom taxonomy URL rewrite on spelling errors
- TV Show database – Best way for structuring it?
- Admin to user notices – best practices?
- Many to Many Taxonomies or rewrite rules?
- Query posts by custom post type and custom taxonomy
- front end radio custom taxonomy with custom post type
- How to display the rest of categories on Portfolio filterable
- Custom post query by taxonomy
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- How can I show recent posts from same taxonomy as the post currently being viewed?
- How to get the first term for the current taxonomy?
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Group custom posts by custom taxonomy names
- Display Posts in Custom Post Types Timber
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- How to convert custom post type based list to a dropdown list?
- Wrong request query on cpt and tax
- Display all post titles of current post type
- Getting a PHP Notice when using Pods with WPML [closed]
- Custom post type multiple loop by taxonomy term
- Extending AZIndex plugin to use custom post types and custom taxonomies
- How to display custom taxonomies with links in filter menu?
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- How to Filter custom post type by taxonomy?
- Listing posts under primary and secondary taxonomies
- What’s the WP way to load remaining custom posts?
- Listing custom terms in custom post meta
- WordPress subpages to custom post types
- Custom post type Permalinks with hierarchical Taxonomies
- How do I display a list showing custom post types nested within a taxonomy?
- Display posts with tag for custom post type only
- Can’t use pagination with custom taxonomy
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Targeting categories in custom fields
- How to show all taxonomies within custom post type loop
- Showing taxonomy terms on custom post type
- How to define the template for custom posts?
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- How to list custom post types on a custom post type page?
- Custom post type categories gives 404 error
- Using WP_Query, I want to show posts that are associated with a custom taxonomy term
- Query Posts that have Custom Taxonomy
- Custom Taxonomy Terms in Menu lead to which page?
- Multiple archives to display parent and subcategories content
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Custom taxonomy and post type rewrite rules
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- How can I loop at a Specific Taxonomy from a custom post type?
- Display custom post type taxonomy in a WordPress excerpt for current post
- Custom taxonomy returns 404 even with saving permalinks
- Custom post type shortcode with taxonomy attribute not working and no errors
- Redirect Custom Post Type from Child Taxonomies
- Ajax load more inside custom post type taxonomy
- How can I get the last 5 element of this tax query?
- Add other all taxonomies as meta boxes to custom post type
- Custom post edit page permalink links to edit page rather than the post
- Create a custom wp_query from a specific custom post type with specific taxonomy
- URL with Hierarchical Taxonomies and same slug for all terms and sub-terms
- Show tags of custom post types in WordPress
- Show posts for current taxonomy
- order taxonomy alphabetical
- Custom post type archive page not showing on archive-posttype.php
- Query Pulling the same post twice
- Cannot retrieve Custom Taxonomies (Disappeared)
- Custom Post type and Taxonomy in post URL error
- Display Custom taxonomy, Child terms and posts in a template Under Specific Parent terms
- Loop multiple taxonomy in custom post
- List all posts from custom post type by taxonomy
- Sort a custom post type loop by a custom taxomomy instead of chronologically
- How to Create Custom Post Type with Multiple Color Options?
- Add custom taxonomies as class names to an archive page of custom post types
- Custom Post Type Base URL
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Custom Post Type urls not working
- pre_get_posts causes Custom Posts appear under ‘Pages’ menu
- Show a wordpress custom post condtionally using a category term