WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Taxonomy Terms List] Remove Link

[Plugin: Taxonomy Terms List] Remove Link

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    If you are using <?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?> , go to wp-includes/category-template.php, locate the function and remove the unnecessary code. Your function will have to look like this :

    function get_the_term_list( $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;
    	}

    I hope it helps.
    Cheers!

    Hi Everyone,

    Just for those who struggle with php inside of WordPress I’d like to clarify something.

    The only difference in the code provide by valentin88 and what is originally found inside of wp-includes/category-template.php is this

    $term_links[] = $term->name ;
    
    /* instead of the following */
    
    $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';

    And in addition to the Taxonomy Terms List Plugin…

    I’m also trying another plugin by the same author – Michael Fields – called Taxonomy List Shortcode

    At first I was wondering if changing wp-includes/category-template.php to remove links from the Taxonomy Terms List plugin would effect the other plugin.

    And it seems there is no issues. I hope this is useful.

    One question though….

    When new versions of WordPress are released will upgrading cause the edits to wp-includes/category-template.php to be overwritten?

    Thanks and I look forward to your replies

    Eric

    Hi Eric,

    Unfortunately yes, when you will upgrade the wp version, the category-template will be overwritten .

    I faced with this problem too, and I resolved it by copying the function in the functions.php from my theme folder , and I’ve named it get_the_term_list_unlinked. Of course, if you are using multiple themes, you will have to copy the function to every functions.php of these themes.

    I hope this is the answer you are looking for .
    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Taxonomy Terms List] Remove Link’ is closed to new replies.