Support » Fixing WordPress » Get category name in current category

  • Hello there. I’m having trouble displaying the category name while browsing a specific category. Let’s say I add a post and give it two categories, for example “Food” and “Music”. Then when I visit the post on my site, I want only one of the categories to be displayed. Displaying only one I know how to do, but it always picks the first alphabetically correct category. Is there a way to control which category I want to display?

    Also, if I go to and click on a post there, I want the displayed category to be “food”, but if I click on the same post through /category/music, I want the displayed category to be music instead. Is there a way to work around this or is it not possible?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    It’s all possible, but tracking down all the details needed to implement it could be somewhat involved. First you would have to modify the category meta box so you can somehow indicate which category should be the primary category. Then you’ll need your own list categories tag that knows about this designation, but also knows to look where the link request came from so it can substitute the appropriate category when necessary.

    I think I get where you’re coming from for this, but from a user perspective, this concept seems a bit dishonest, like you’re hiding information from me. You’re misrepresenting which category something was assigned based on which route I followed to the post. Showing all the categories gives me more opportunities to explore related topics on your site. Something to consider? Not that what I think matters at all for your site 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Get category name in current category’ is closed to new replies.