You will need to know the name for your “portfolio_tags” taxonomy. Check where it is defined as a custom taxonomy, and it will need to be added to the portfolio custom post type.
The register_taxonomy() function would be your theme like this:
register_taxonomy('portfolio_tags',
array('portfolio'),
array('hierarchical' => false, 'show_ui' => true, 'query_var' => true,
'rewrite' => array( 'slug' => 'portfolio-tags' )));
Or you could be using a custom post / custom taxonomy plugin — then you would need to check what id was given (for example, it could be “portfolio_tag” instead)
Once you have confirmed this, you should use get_the_terms() instead, since it is part of the WordPress API (wp_get_object_terms() isn’t using the object cache so it would be less efficient)
$post_cat = get_the_terms( $post->ID, 'portfolio_tags' );
Finally, in order to use $post-ID
, make sure you are in The Loop or you have referenced the global $post
object.
Related Posts:
- Find callback function for custom taxonomy metabox
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- How would I create a shortcode to display a custom post within a page or regular post?
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Get Posts by Category, Tag , and CPT Taxonomy
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- posts within custom post type all share the same content in the front-end
- Shortcode to return single custom post based on post taxonomy
- Custom posts – tag pagination
- Post visibility option to theme front-end for author to select?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- php dynamic content inside shortcode
- CPT tags not showing when editing post
- From CPT Custom Loop into Shortcode?
- How to convert Post Object Custom Field into Tags
- Load custom post type with ID in a shortcode
- Modify shortcode to work with custom taxonomies and slugs
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- Does anyone have a plugin that could automatically tag custom post types in wordpress?
- wp_insert_post generates endless posts
- Remove standard meta boxes from custom taxonomy
- Can’t query tag and post_type at the same time
- How to create shortcode to display custom field value on a custom post type
- Group posts by custom post type
- How to enable shortcodes in a custom post type?
- Tag page with Custom Post Types not returning any posts
- What’s the difference between same wp functions get_posts(); functions in different form?
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- I did group my search results by post type, but how can i give each of them its own order?
- Dequeue scripts and styles only for specific custom post type
- Get custom fields from a custom post type with a shortcode
- Shortcode for display posts in wp-editor
- Function to display custom post type on front page makes menu items dissapear
- Display Recently Added Custom Post Types with Custom Taxonomy Shortcode
- custom post type not showing in menu
- How to restrict CPT post’s fronted view only for specific user roles?
- Show category ID on custom post type
- How to customize a permalink (URL) structure?
- How to save custom taxonomy from front end post submission
- Custom post types and tag archive pages/permalink structure issue
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Custom Post Type with Templates using Meta Boxes?
- Can I list a custom post type within another custom post type in the admin area?
- Change custom post type slug from plugin options
- Get custom post type list for every category shortcode
- Insert Custom Post Type data from the front-end by a user
- Crafting WP_Query array, sort by date
- search also in taxonomy, tags and custom fields
- Can’t edit custom post type
- Custom post type getting wrong categories and tags
- Listing tags from a custom post type
- Set URL link to featured image of custom post type
- wp_update_term_count_now doesn’t work with a custom post type?
- Add tag to a custom post type doesn’t change the total of custom post type in backend
- Change CPT archive title
- Custom Tag Description unable to display just below and outside of the Loop
- AJAX load more for different custom post type loops
- PHP variable not regenerating when publishing multiple posts at the same time
- Posting to a Custom Post Type from front end – user generated content
- On update or create post redirect to current post position in list
- I need to add endpoint for wordpress categories
- How to get the upcoming post ID from front end?
- How to target a specific custom post type post and its all children and grandchildren?
- Featured image overlay when changing post status
- get_post_meta not working on publishing
- Redirect 404 page with ID in slug to associated page with same ID in slug
- WordPress wrapped added a span tag to every single p tag
- ACF field key/value to show on taxonomy list
- Re-registering a custom post type not working (not showing up)
- Display featured image from one CPT within another CPT query
- Query taxonomy of taxonomy of custom post type
- Best way to style first post differently?
- How to make custom posts types display when published for the future
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- How to rewrite url for any specific taxonomy?
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to render a custom post type template with custom fields using shortcode
- create a new page from a custom post type similar to an authors page
- CPT archive admin menu label
- Anon function and add_meta_box
- Form action/link to render a plugin in WordPress front-end
- custom post type category count shortcode
- Display Child Pages of Custom Post Type Parent Page
- Hide a widget inside a div on specific type of post
- Shortcode not working with post counter
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Changing default ‘posts’ parameters with register_post_type_args
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- Shortcode for CPT post content in a page
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Cannot save CPT meta box
- Cross reference custom post types
- Allow users to create posts without logging in?
- Next Post links not working in custom post type shortcode
- How to change permalink to include custom post type
- How to get all tags of a custom post type by id
- How to make front end form only accept certain values
- Foreach inside shortcode not working as planned
- Configuring a meta query with multiple post types that have the same relationship on a single page