You can try making the $args array more specific with:
$args = array(
'post_type' => 'portfolio',
'tax_query' => array(
array(
'taxonomy' => 'locations',
'field' => 'slug',
'terms' => 'paris'
)
)
);
Grabbed this snippet similar to one on the WP Query page in the codex. Also, this is assuming that your custom post type is called “portfolio” and you have a custom taxonomy, “locations” and the term “paris”. I say this because your question above says:
I am trying the following code, yet it gives me the ALL the posts of
the taxonomy ‘portfolio’ and not just of one term:
So “portfolio” is your custom post type, correct? Anyway, let us know if you find the problem. Good luck!
Related Posts:
- Set terms in a custom post
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- How are terms connected with posts in database?
- Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms
- get_terms parent for current product only
- deleting terms programmatically
- Adding Multiple Values to a Post Meta Key
- Remove custom posts that match taxonomy value
- Using Custom Posts with Metaboxes and Drop-downs
- Avoid duplicate post from same Taxonomy
- How to display data in archive page?
- Setting posts_per_page for taxonomy term template
- Duplicate Custom Post Type and Taxonomy Slug
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- How to display posts via custom taxonomy terms using checkboxes?
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- Loop parent terms {display posts} AND loop child terms {display posts}
- relating business and products with custom taxonomy?
- How To Use Custom Tax of a Post Type
- How to output all taxonomy links from a custom post type in a menu?
- Show post count in custom taxonomy page
- Loop through taxonomies and loop through their terms (Newbie question)
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- Multiple Custom Post Type loop logic
- How to list all names and descriptions of a custom taxonomy
- 404 for some custom taxonomy not ALL taxonomy
- Displaying Results From Custom Taxonomy Query
- How to get all the terms of a post
- Special Query: Title, Terms, Content – %LIKE%
- Taxonomy Category category.php not working
- Different post sort order within different categories
- Custom Post Types, slug, archive and SEO plugins
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- How to disable drafts?
- how to enable different number of revisions for different blogs when using WPMU?
- Unattaching images from a post
- Fast way to add countries as a custom taxonomy term?
- Allow role to delete posts but block him the wp-admin
- Does an action fire when adding a tag via the “Tags” meta box?
- How can I add a meta-box to the posts editor containing all items of a custom taxonomy as checkbox?
- How to show featured image in custom post type dashboard post page
- Posts vs. Pages
- Dynamic carousel on individual posts
- How to add pagination in between post and comments?
- WordPress blog or WordPress website
- Show posts by a custom post author
- Force the “Choose from the most used tags” meta box section to always be expanded
- Search results posts_orderby and ID
- Making a custom Pagination for multi page blog post
- Unable to restore from backup – how to obtain old blog posts?
- How can I setup a relationship using categories in WordPress?
- custom post template file not shown, instead all the time 404.php
- Custom Post Type Rewrite To Include Parent Page(s)
- 404 error on default post type and default taxonomy fronted page
- Thumbnail & Category link aside post
- Redirect to another page using contact form 7? [closed]
- outputting posts’ taxonomies: cant get ‘get_the_taxonomies’ working
- Custom taxonomy archive page problem
- Is there a query string for edit.php to show all posts that have no custom taxonomy terms?
- Custom Post Type archive
- WordPress custom post type with folder structure in slug
- How to add convenient buttons for new custom post statuses
- wp_set_object_terms NOT working on CPT, but wp_set_post_terms does
- Show custom post with custom categories with specific slug
- Auto delete posts based on content text
- Count the number of a post types associated with another post type
- Display value of custom field at the beginning of a post
- Get current post’s nav menu name (term name)
- Add post tags to previously created custom post type
- add_rewrite_rule and template redirect not working
- Changing permalink of WordPress
- Hook save_post_cpt not triggered when custom fields are modified
- How to display the post categories for each post inside the loop with custom format?
- Pagination Not Working With Custom Post Type Category
- WordPress Pods Custom Post Type – separate Media Upload folder for each custom Post Types
- Put page on Archived statut after end of publication date
- post and page and custom post type
- My posts page is missing the page title
- Show custom post category for single post
- Add Categories To Custom Post
- wordpress display posts by terms id or name
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- Custom Taxonomy From Database
- Creating widget – ask for selecting a post in the admin panel
- issue in wordpress auto delete post and redirect to another 1
- Custom Single Post Type not referring to single-post-type.php File
- “Current” class on a singular page menu item with custom post types?
- Loop through posts by each term and exclude duplicate posts assigned to several terms
- How can I allow users (subscribers) to download selected posts into a single PDF? (RESOLVED)
- Choose options via url
- Custom Post Type Pagination 404 Error (if paged>=2) [duplicate]
- retrieve post slug by post_tags taxonomy
- Display ONLY Latest Post From Several Categories
- custom post type single page template not working
- Display post structure in function
- Dynamic Menu Item
- Changes done in admin panel are taking time to reflect in the REST api responses
- I have a website issue I am trying to resolve