[resolved] the_tags and add_filter (4 posts)

  1. Tec
    Posted 8 years ago #

    So, I was trying to update one of my personal plugins. I'm trying to apply a filter to the_tags filter with this code.

    add_filter('the_tags', 'tag2lowercase');

    I know I got that right but I can't seem to make it work. No filters are being applied to the_tags. On the other hand, it works well with wp_tag_cloud. Anyone knows if this is a bug or something. And aside from tinkering with category-template.php, is there a way for me to force lowercase in my tags?

  2. Michael Fields
    Posted 8 years ago #


    This is odd, but The hook the_tags does not get used by the function the_tags. Please try this code:

    add_filter( "term_links-post_tag", 'tag2lowercase' );
    function tag2lowercase( $c ){
    	foreach( (array) $c as $k => $v ){
    		$a[] = strtolower( $v );
    	return $a;
  3. Tec
    Posted 8 years ago #

    Hi mfields! Thanks a lot for the code. I was finally able to make it work. :)

  4. girvanliu
    Posted 7 years ago #

    Thanks a lot. The code resolved my problem.

Topic Closed

This topic has been closed to new replies.

About this Topic