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
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- Including taxonomy term before post type breaks top level pages
- ‘exclude’ argument is not working with get_posts for a custom post type
- Correct procedure for advanced permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- List Taxonomy Terms based on another Taxonomy
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- CPT’s with landing page instead of archive – Url Rewrite?
- Template for all categories of a custom post type?
- How to change permalink to include custom post type
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- posttype/taxonomy/term archive page 404 error
- How to add attributes to taxonomies that may be different from post to post?
- Display taxonomy terms, child terms and posts in a template
- Custom post type, permalinks, taxonomies and blog posts
- How to group posts and get a mixed posts and groups view?
- Custom post type permalink tag 404
- How to make front end form only accept certain values
- How to get list of taxonomy slugs ordered parents>childs?
- Custom Post Type by Taxonomy
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Use custom walker to add taxonomy terms to main nav menu
- Post format alternative?
- WP_Query orderby and tax_query
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- browse by category and tags?
- permalink /category/post-name with custom post type and taxonomy
- Taxonomy structure help
- Querying Custom Post Type, ordering by Custom Taxonomy Pagination Not Working
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Custom Taxonomy not being saved on custom posttype
- Create more category hierarchical depth for custom post type/taxonomy plugin (widget)
- Displaying Custom Taxonomies From Multiple Custom Post Types
- Hierarchial Custom Post Types/Taxonomies
- Custom post type and taxonomy permalinks
- How do I share categories across multiple post types?
- Exclude custom taxonomy term posts from custom post loop
- Hierarchical permalinks for custom post type and taxonomy
- Migrating a taxonomy’s tags to the native category
- Add term to custom post type on draft
- Multiple tag cloud filtering
- List of Posts and Categories
- Grouping of CPTs and taxonomies into menu groups in admin
- Best way to organize book-page structure
- Get url.com/post_type/taxonomy/term work!
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- Invalid argument supplied in register_taxonomy $args->taxonomies
- set permalink for CPT
- Top Level pages in wordpress giving 404, but child pages working fine
- Sitemap generation
- Plugin fatal error
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy/Custom post type structure suggestion on a movie site
- Search by tag name and category
- Taxonomy in URL
- Ordering values entered in Custom Taxonomies
- Listing all term items alphabetically / sorting loop
- How to produce a sub-page-system in WordPress
- Change the Custom Taxonomy URL Slug pattern
- Advanced search form with filters for custom taxonomies
- Custom taxonomy and post type with same slug
- Losing Nav Active State in Menu
- WordPress custom taxonomy template not working
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Listing custom terms in custom post meta
- Show fields based on taxonomy selection in editor
- Display related custom taxonomy posts in sidebar
- WordPress subpages to custom post types
- Different rewrite rules for taxonomies and cp in multisite?
- Permalinks: custom structure for taxonomy – tags?
- count results in search page based on custom category
- Custom permalink with child taxonomy terms
- Assign Custom post to Custom Taxonomy
- Custom post type Permalinks with hierarchical Taxonomies
- Display Registered Taxonomies
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- Show custom post type inside a custom post type
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Create a permalink structure with custom taxonomies and custom post types gives 404
- Display and register custom categories for custom post types
- Why is my WP_Query outputting my entries twice?