• Resolved blackcat1975

    (@blackcat1975)


    I would like there to be no link on the taxonomy term. At the moment I can’t find a way to remove them.
    The current function I have is not adding the link so I am not sure where the link is being added.

    function get_the_term_list_unlinked( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
        $terms = get_the_terms( $id, $taxonomy );
            if ( is_wp_error( $terms ) )
    	         return $terms;
              if ( empty( $terms ) )
    	          return false;
    	        foreach ( $terms as $term ) {
    	                $link = get_term_link( $term, $taxonomy );
    	                if ( is_wp_error( $link ) )
    	                        return $link;
    	                $term_links[] = $term->name ;
    	        }
    	        $term_links = apply_filters( "term_links-$taxonomy", $term_links );
    	        return $before . join( $sep, $term_links ) . $after;
    }

    https://www.ads-software.com/plugins/custom-post-type-ui/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    So you want just the url, without the actual <a> link as well?

    This is pretty simple just replace this:
    $term_links[] = $term->name ;
    
    with this below: There are two. One with post count and one with out
    
    this is without postcount:
    $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>'; 
    
    This is with post count:
    $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . ' - ' . '(' . $term->count . ')' . '</a>';

    Hope that helps

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘remove links on the taxonomy term’ is closed to new replies.