You have a lot of errors in the code and a misunderstanding regarding the categories.
- Never use
query_posts to create a custom query
Note. This feature is not intended for use by plugins or themes. As explained below, there are more efficient, more effective options for modifying the main request. query_posts () is too simplistic and problematic way to modify the main page request by replacing it with a new instance of the request. It is inefficient (re-runs SQL queries) and in some cases it will fail unexpectedly (especially often when working with pagination)
If you need to run a custom query, use WP_Query or get_posts
category_name accepts a category slug , not a name . Parameter name is cheating
"Categories" related to user taxonomy are called terms. I wrote a post that I also included in the code, which you can check here , it describes the differences.
To get posts from a custom taxonomy, you need to use tax_query . Category options will not work here.
Based on the foregoing, create your request so that it looks like this:
$args = array( 'post_type' => 'recipes', 'tax_query' => array( array( 'taxonomy' => 'recipescategory', 'field' => 'name', 'terms' => 'Starters', ), ), ); $query = new WP_Query( $args ); if( $query->have_posts() ){ while( $query->have_posts() ) { $query->the_post();
source share