• Hi, I use a category for internal purposes and am trying to hide it from appearing on my site as a clickable link. I have managed to get 90pct of the way there. I use the following code in functions.php which removes the text / link from category section on posts / archives:

    function the_category_filter($thelist,$separator=' ') {
    	if(!defined('WP_ADMIN')) {
    		//list the category names to exclude
    		$exclude = array('Uncategorized','Update');
    		$cats = explode($separator,$thelist);
    		$newlist = array();
    		foreach($cats as $cat) {
    			$catname = trim(strip_tags($cat));
    			if(!in_array($catname,$exclude))
    				$newlist[] = $cat;
    		}
    		return implode($separator,$newlist);
    	} else
    		return $thelist;
    }
    add_filter('the_category','the_category_filter',10,2);

    This came from http://wordpress.org/support/topic/excluding-categories-in-the_category and is old but works fine as far as I can see.

    The problem is I have a static front page which pulls info from the blogroll to populate. Specifically looking at my structure it seems to use the_terms to grab categories as follows:

    <p><span class="post-category"><i class="icon-pencil"></i> Posted in <?php the_terms($post->ID, 'category', '', ', ', ''); ?></span></p>

    Codec link http://codex.wordpress.org/Function_Reference/the_terms

    Is there any way I can filter this or alter the method the data is pulled in to stop the ‘Update’ category being displayed?

Viewing 1 replies (of 1 total)
  • Thread Starter Paul Skip Brown

    (@paul-skip-brown)

    Hello, I still haven’t been able to resolve this. Is anyone able to offer any guidance at all? Would be great if the function could be edited to work with ‘the_terms’ rather than ‘the_category’? Any support appreciated.

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude category from the_terms’ is closed to new replies.