The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

filtering certain specific tags (3 posts)

  1. gmorehoudh
    Posted 7 years ago #

    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?

  2. 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.

  3. gmorehoudh
    Posted 7 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic