Support » Plugins » filtering certain specific tags

  • I’m trying to filter a certain tag so that users can’t see it when they read my blog. It’s to be used for internal purposes. However, this code isn’t working:

    function hide_noaff_tag($tag) {
    	if($tag === "noaff") {
    		return null;
    	} else {
    		return "lol" . $tag;


    add_filter('the_tags', 'hide_noaff_tag');

    Note the ‘lol’ test there — the tags aren’t even displaying with the lol prepended. What am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I know, the tag filters are mucked up. Anyway, you’re using them wrong even if they were correct.

    function hide_noaff_tag($tags) {
    	$ret = array();
    	foreach ($tags as $tag) {
    		if (strpos($tag,'noaff') === false) {
    	return $ret;

    Try something more like that.

    Once again, thanks for your help. 🙂 It seems the documentation is a little dated. :/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘filtering certain specific tags’ is closed to new replies.