As written here, you need to use two nested arrays in the tax_query
argument.
So, with your arguments it should look like this:
$args = array ( 'post_type' => 'restaurants', 'tax_query' => array (array( 'taxonomy' => 'location', 'field' => 'slug', 'terms' => 'citya') ), 'order_by' => 'title', 'order' => 'ASC' );
If you only need to query for 1 Term, you can also use the easy way:
$args = array ( 'post_type' => 'restaurants', 'location' => 'citya' , 'order_by' => 'title', 'order' => 'ASC' );
Related Posts:
- Custom Post Type Archives by Date and Taxonomy
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- How to completely disable a taxonomy archive on the frontend?
- How to limit the number of terms (terms acts like categories)
- Custom Post Type – Taxonomy Dropdown Menu?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Taxonomy term in permalink
- How do I display two separate taxonomy archives for two post types that share a single taxonomy?
- Taxonomy + post_type
- Using 1 taxonomy for multiple post types?
- Filtering Posts by Multiple Taxonomy Terms such as in an Admin Post Listing?
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- How would I leverage custom Taxonomies in this scenario?
- How to get a list of term names of the custom post type im currently on in single.php
- Group list of posts by taxonomy and allow for pagination
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- Disable WordPress Recognizing Path as Attachment
- Get the most popular terms for a custom post type
- Registering tags taxonomy for a custom post type
- Is slug “type” reserved and can’t be used in taxonomy rewrite?
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- How do I display custom post types through a common taxonomy?
- Paginate_links won’t create the right links on a taxonomy filtered custom post type archive
- Taxonomy Templates
- Category page only displaying the posts from a custom type
- Bug when editing custom post type category?
- Having trouble understanding custom post type and taxonomy :/
- Assign Taxonomy Based on Custom Field Value
- Custom Taxonomy Creates Unwanted Integer Terms on Post Save
- How to filter out post type meta?
- Conditional regex in add_rewrite_rule() for specific query filters & pagination
- Query Multiple Taxominies Across Multiple Post type’s
- Update permalinks when new category added to custom post type taxonomy
- Custom Post Type Taxonomy Filters
- Taxonomy custom post type URL
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- Custom post taxonomies as tax_query terms?
- Get related posts of child term of custom post type
- How do I display the taxonomy for a custom post type in an array
- Suggested Post and Taxonomy structure
- Custom post with more than one custom taxonomy
- How to get list of taxonomy slugs ordered parents>childs?
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Multiple tag cloud filtering
- Get url.com/post_type/taxonomy/term work!
- Review site custom post type structure
- Different Category system needed for the Custom Post Type
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Linking from CPT page to taxonomy.php
- Page not found for custom post type UI plugin and taxonomy
- Categories and tags for custom post types
- How to get all Custom Post Type Filtered by one Specific Taxonomy Term
- Filter second dropdown (tax) based on first dropdown (cpt)
- How can I create an automatic drop down menu with my tags?
- How to define a term for custom taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- Get taxonomy singular name instead of taxonomy slug inside $taxonomy query
- Get assigned post categories
- Query custom post types & Taxonomies and list them in a table on a page
- Default Category Page not showing custom post type which has taxonomy category
- Custom taxonomy template shows 404 Error
- Custom Post Type API doesn’t show taxonomy or category array
- How to constrain the results to a specific post_type on tag archive page?
- Creating custom post type posts and associating them with a post from another custom post type
- Custom Post Type with modified permalink structure results in 404
- Problems making shortcode with custom post types and taxonomy
- Custom Post taxonomy template
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- How to use taxonomy term as permalink folder
- Filter taxonomy by CPT
- automatically select taxonomy based on post meta
- Display related CPT with custom taxonomy
- Custom permalink structure for custom post types including multiple taxonomy
- How to group custom posts in admin menu based off taxonomy/postmeta
- How to get current post type?
- Custom post types not showing on the standard WordPress Category page
- Display 3 level taxonomies
- List posts that have the current url taxonomy
- If custom taxonomy exist on post?
- How to get all posts assigned to a taxonomy term only?
- Wrap an X amount of taxonomy posts in a separate Row in WordPress
- I want to create an archive and single page for a custom taxonomy for a custom post type
- Taxonomy’s title
- Display all posts from single taxonomy term
- How to show post which has the specific taxonomy terms?
- Displaying the Taxonomy and a Queried Term on a taxonomy.php page?
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- WordPress add taxonomies/terms list as a menu in archive page
- Default taxonomy ‘post_tag’ added to CPT managing by custom role : nothing in the metabox
- Custom Search not working
- Custom post type post taxonomies
- category_name not working in WP_Query
- Problems with custom post type and hierarchical permalinks
- How can I set up the URL for a category archive for a custom post type?
- Structure of custom post type / taxonomy?
- Query multiple post of which one by taxonomy
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List