Home / functions.php / Add a custom class to the_tags
  • How to Add a custom class to the_tags


    Adding this snippet to the functions.php of your wordpress theme will add a custom class to links output by the_tags template tag.

    wordpress snippet : PHP

    function add_class_the_tags($html){
        $postid = get_the_ID();
        $html = str_replace('<a','<a class="wpsnipp"',$html);
        return $html;

    ( WordPress codex functions, hooks, in this snippet. )

    the_tags, get_the_ID, the_ID, add_filter, wp,