Show taxonomy term without hyperlink (disable link of taxonomy term)

Content Views helps you to show taxonomy term (category, tag, custom) of post easily without coding.
By default, term name with hyperlink to the term page will be shown.

To show term name without link, please add this code to file functions.php in the theme’s folder (or install this plugin Code Snippets then add this code to the “Code” textarea):

  • For a single View:
    // Content Views Pro - Show term without hyperlink
    add_filter( 'pt_cv_post_term_html', 'cvp_theme_taxonomy_no_link', 100, 2 );
    function cvp_theme_taxonomy_no_link( $args, $term ) {
    	global $pt_cv_id;
    	if ( $pt_cv_id === 'VIEW_ID' ) {
    		$args = $term->name;
    	}
    
    	return $args;
    }
    

    (replace VIEW_ID with ID of the View)

  • For all Views:
    // Content Views Pro - Show term without hyperlink
    add_filter( 'pt_cv_post_term_html', 'cvp_theme_taxonomy_no_link', 100, 2 );
    function cvp_theme_taxonomy_no_link( $args, $term ) {
    	$args = $term->name;
    	return $args;
    }
    

Best regards,

Scroll to Top