WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a short piece of code(which is modified, originally it was a plugin-Taxonomy Terms List) to display custom taxonomies after the post,

When the terms are displayed, it is displayed with a href tag. I don't want the terms to be a link, I just want simple terms text.

How can I get that?

Here is my current code:

if( !function_exists( 'pr' ) ) {
    function pr1( $var ) {
        print '<pre>' . print_r( $var, true ) . '</pre>';
    }
}

if( !function_exists( 'mfields_taxonomy_terms_list1' ) ) {
    function mfields_taxonomy_terms_list1( $c ) {
        global $post;
        $o = '';

        $terms = array();
        $lists = array();
        $custom_taxonomy_names = array();
        $custom_taxonomies = mfields_get_custom_taxonomies1();

        if( !empty( $custom_taxonomies ) )
            foreach( $custom_taxonomies as $name => $config )
                $custom_taxonomy_names[] = $config->name;

        if( !empty( $custom_taxonomy_names ) )
            $terms = get_terms( $custom_taxonomy_names );

        foreach( $custom_taxonomies as $name => $config )
            $o.= get_the_term_list( $post->ID, $name, $before = '', $sep = ' | ', $after = '' );

        if( is_single() )
            return $c . $o;

        return $c;
    }

    add_shortcode('terms1', 'mfields_taxonomy_terms_list1');
}

if( !function_exists( 'mfields_get_custom_taxonomies1' ) ) {
    function mfields_get_custom_taxonomies1( ) {
        global $wp_taxonomies;

        $custom_taxonomies = array();
        $default_taxonomies = array( 'post_tag', 'category', 'link_category' );

        foreach( $wp_taxonomies as $slug => $config ) 
            if( !in_array( $slug, $default_taxonomies ) )
                $custom_taxonomies[$slug] = $config;

        return $custom_taxonomies;
    }
}

add_action( 'wp_print_scripts', 'enqueue_slideout' );
share|improve this question
up vote 2 down vote accepted

You could use get_the_terms() instead: http://codex.wordpress.org/Function_Reference/get_the_terms

This just gives you an array of the associated terms. Then use that array to create your own list without links.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.