• nemci7v

    (@nemci7v)


    I created a custom taxonomy called “portfolio” and added the tags column to the custom post type using:

    register_taxonomy_for_object_type( 'post_tag', 'portfolio' );

    After I add the tags widget to the sidebar, the tag cloud shows all the tags from all my posts. How can I show tags that belong only to the “portfolio” taxonomy?

    Also is there a way to change the default name “Tags” for the portfolio taxonomy to “Portfolio Tags”?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Your post is confusing because you appear to be mixing terminology. I believe you meant to say you created a custom post type “Portfolio” and associated the default Post Tag taxonomy to it. I’m going with this interpretation, apologies if I misunderstood.

    You can use the ‘pre_get_posts’ action to set only ‘portfolio’ as the value for the ‘post_type’ query var. All queries go through this action, so you must use conditionals to only apply this setting for ‘post_tag’ taxonomy archive queries. This will also mean other post types tagged can no longer be queried by tags unless you concoct some other custom query var scheme to distinguish portfolio tag queries from other tag queries.

    You cannot change the actual name of the post tag taxonomy, however on the front end you can cause all output related to post tags to say whatever you like. For the tag widget, simply edit the title on the Widgets admin screen.

Viewing 1 replies (of 1 total)
  • The topic ‘Show tags belonging to custom taxonomy’ is closed to new replies.