• Resolved humain

    (@humain)


    Hello-
    I’ve done a pretty thorough search and haven’t found a solution or even a topic

    addressing this one.

    What I’d like to do is exclude a tag from the tag list in the footer of each post

    when the user is viewing the tag index that matches that tag.

    For instance, if I have a tag called “Apples” the user clicks that tag to get to

    the tag index where all “Apples” posts are displayed. Each post on this page has

    it’s tags listed at the bottom of the post. I’d like these tags to display as they

    do, but want to exclude “Apples” from the tag list since they’re already on the

    “Apples” tag index page. Make sense?

    I’m certain there isn’t an argument available to use off the shelf and some custom

    code would be needed. Anyone have any ideas on how to go about this?

    I appreciate the help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • one possibility is to use a filter function, to be added into functions.php of your theme:

    https://pastebin.com/mzdHVppw

    this example should leave the tag in the list, but removes the link from it.

    imho, totally removing the tag from the list would be confusing.

    Thread Starter humain

    (@humain)

    Wow. Thanks for the quick reply.

    That worked like a charm. However, my client really wants the entire link removed. I don’t have strong feelings on which approach is better, just need to make the client happy ;).

    Would you be able to show me an example of removing the entire tag?

    Thanks again for the help.

    no problem – a tag list with the current tag removed in tag archives:

    https://pastebin.com/uvDRnAuf

    the $before, $sep, and $after are still controlled by the code in the loop of the (tag) archive template;

    if there is only one tag in a post, and this is the current tag in the tag archive, it will show a -
    example: Tags: -

    (you should be able to find this in the code in case you need to chdnge it)

    Thread Starter humain

    (@humain)

    Dude, you are amazing. That worked absolutely perfectly.

    I can’t thank you enough for helping me out with this so quickly.

    Just another reason why WordPress is so great: The best online community.

    Thanks again!

    glad I could help;
    you are welcome ??

    please mark the topic as resolved – thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to exclude a tag from the tag list when on the matching tag index page.’ is closed to new replies.