Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.