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 Taxonomy as Dropdown in admin
- Custom Post Type Archives by Date and Taxonomy
- How to completely disable a taxonomy archive on the frontend?
- Taxonomy count per Post type
- How do I display two separate taxonomy archives for two post types that share a single taxonomy?
- Query Custom Post Type taxonomy type based on page
- Taxonomy + post_type
- Using 1 taxonomy for multiple post types?
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?
- How to get a list of term names of the custom post type im currently on in single.php
- How to show term-specific post list, without posts associated with child terms?
- Custom Post Type with Custom Title
- Get the most popular terms for a custom post type
- Custom Post Type: How to display all of same taxonomy?
- Remove “-2” from a Toolset Types URL with the same post name
- List all custom post type posts from a given category?
- Registering tags taxonomy for a custom post type
- Custom post type taxonomy template
- 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?
- Custom post type with specific category structure
- Taxonomy Templates
- Category page only displaying the posts from a custom type
- Custom Post Type and Taxonomy combination
- 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
- Exclude specific taxonomy term when using wp_get_post_terms
- tax_query returning all posts instead of selective posts in WP_Query
- Get Post Primary Category
- How to check the terms in single custom post type template
- Custom Post Type Taxonomy Filters
- 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 check if the user is on a taxonomy term parent, child or grandchild page?
- WordPress Doesn’t Generate Taxonomy Archive
- Custom post with more than one custom taxonomy
- Get the taxonomy of a post hierarchically
- 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
- How to organize hierarchical structure in custom post type with taxonomy (like with categories)
- Taxonomy in URL
- How to organise this data within WordPress
- How to Set Taxonomy Object Description?
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Variable not working in WP_Query
- Associate all Custom Post Types with Taxonomy
- Invalid Taxonomy
- Alphabetically sort a taxonomy.php template by post title
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Show Taxonomies with admin area for custom post type?
- Remove categories taxonomy from custom post type
- Changing CPT slug and taxonomy already registered in parent theme
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Query Custom Post Type by Taxonomy
- Copying over taxonomy structure from one CPT to another
- Display ONE taxonomy and its assigned pages
- Menu for taxonomies and posts belongs to taxonomy
- How to automatically create a terms based on each post of a post type
- Page that lists publications by classifying them by taxonomy
- How to order taxonomy terms by most recent post?
- Custom taxonomy returns 404 even with saving permalinks
- Create custom post type categories
- How to display all terms from all taxonomies in post, but separately for each taxonomy?
- Set a Default CPT taxonomy by taxonomy id
- List all posts associated under custom taxonomy
- how to create custom taxonomy drop downs for parents and child
- Get name CPT with slug taxonomy
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- Automatically / dynamically populating tags in custom post type
- Custom post type category link + add to menu
- Single taxonomy for different custom post types
- Taxonomy and Custom Post type with Collpase
- How to create groups like that in buddypress?
- Organising custom taxonomies and custom post types
- Filter Term By Parent Term – Custom Post Type
- Best approach to allow front-end display of posts’ reviewers?
- get children from current variable (taxonomy) via shortcode
- Custom Post Type and Taxonomies, creating the corresponding template file and loop the data
- Custom Post Type parent slug as menu item
- List all posts from custom post type by taxonomy
- Taxonomy Grid Archive Help?
- Archive templates based on taxonomies
- Show taxonomies from specific CPT
- List a custom post type’s posts ordered by nested custom taxonomy
- Author template – separate custom post type by custom taxonomy term for $curauth
- Single and Archive Pages with Custom Post Type
- Sharing a custom taxonomy – No posts?
- See the process of creating a taxonomy and tell me where I made a mistake
- show only one category posts in admin
- custom taxonomy not return in the code
- How do I get parameters from the URL?
- Show only taxonomy types terms associated with a custom post type in WordPress PHP
- Taxonomy term archive claims there are no posts, but there are. How to resolve?
- How to list custom taxonomy terms without the hyperlinks?