Your question is very unclear (given that you don’t actually ask a question), but there are 2 problems with your code, both of which are corrected below:
$args = array (
//'post_type' => 'article',
'posts_per_page' => 5,
'category_name' => 'starter', // changed from 'category' to 'category_name'
'meta_query' => array (
array (
'key' => 'recommended_article',
'value' => '1',
'compare' => '=', // changed from '==' to '='
),
),
) ;
$query = new WP_Query ($args) ;
while ($query->have_posts ()) {
the_content () ;
}
For the details of why these changes are necessary, see WP_Query, Category Parameters and WP_Query, Custom Field Parameters.
Related Posts:
- WP_Query by a category id and a custom post_type
- Exclude a category from WP_Query
- WP_Query ignores post_type in category view
- category__in not working on custom post type
- List with categories, subcategories and posts of custom posttype
- New WP_query in template not working with CPT+category on some pages
- WP Query group/order by category name
- List all custom post type posts from a given category?
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts
- Query Custom Post by Category
- Loop through categories and create tab for each
- Getting all custom posts with a certain category
- Query Custom Post Types & category_name?
- Show Post Count of a Category
- CPT posts listed by category with custom rewrite URL, please help!
- Querying Term Posts in Loop
- Pagination on category page with custom post types
- How to show CPTs in term archive
- showing custom post types of a certain category only
- Linking to the most recent post in a Custom Post Type
- Show custom post type filtered by category
- forming WP_Query for posts of all post types but from specific categories
- WP Query with categories only shows one post and ignores the category
- Why is my category template ignoring post type?
- WP the_posts() on single-cars.php get category link
- WP_Query Custom Post Type if Category ID Equals
- Custom post types and ‘new WP_Query’
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- List categories, subcategories and posts from custom taxonomy and custom post type
- WP Query results showing posts outside of category ID
- Create query for both custom post type and category
- How to properly use Categories with Custom Post Types
- How to output custom post type title on custom page with category next to it?
- Custom Post By Category
- Only show categories that have posts within custom post type
- Query the title of the page to show posts with matching category in the loop
- Only show current category post
- Can’t seem to filter wp_query by current category ID
- Custom Post Type + Category archive
- category_name not working in WP_Query
- Get all custom_post_type posts + blog posts from one category in a single query
- Using tax_query to get single post per category
- Are custom posts included when getting a categories’ posts?
- Is it possible to make is_category() recursive?
- Get Posts in a Custom Post Type category
- How to query for posts (in hierarchical custom post type) that have children?
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Get the post_type of current taxonomy or category page
- Query for posts in 2 taxonomies
- Parent / Child formatting in a list of post of a custom post type
- How do I create an archive page for standard posts?
- custom taxonomy archive by year
- How to detect filter in URL in Category page?
- Combining sorted and random CPT
- How to add post_type=value when editing that post type in the WordPress admin?
- Get posts from a custom post type by child categories of a parent category
- Show a Category X’s custom post type on Category X archive page?
- Getting categories of posts under a custom taxonomy
- Custom taxonomies relationship
- WP_Query orderby and tax_query
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Different Ways to Query Custom Post Types?
- Get parent category id from child category page for custom taxonomy
- find custom post type post by searching its custom field with my string
- wordpress lists similar type of posts in a custom post type
- FacetWP paging custom wp_query
- Cannot get custom posts by category
- Pagination for search results of custom post type [duplicate]
- WP_Query get post from a category and from another post type
- foreach loop inside the loop creating duplicates in output
- Category Name with Custom Post Type
- All blog posts are not showing up
- CPT archive page – show one post from each taxonomy term
- Custom post-type custom query – show all posts
- how to organize my categories or should I do custom post types for some?
- Order Categories by Hierarchy?
- Multiple categories assigned to a single product breaking the breadcrumb
- meta query condition don’t work
- Filter posts by their related field’s custom field
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- How do I get all authors posts of a custom post type outside loop
- minimize wp_query call to database
- sorting in wp query based on custom field value
- WordPress loop add heading before first of type
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- Is it possible to add query parameters on the archive page?
- Custom Catagory not found
- Page to show custom posts and one category
- How can I list custom post by custom category?
- Storing/querying custom date data
- Query Posts From Multiple Post Types
- Use only selected regular categories for a Custom post form
- Custom Post-type not returning the right child_of
- Bulk remove category from custom post type?
- How do I hide single category post on my post page
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Quering array of post types & pagination. Articles are repeating sometimes on different pages