WordPress.org

Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #27238


Ignore:
Timestamp:
02/28/2014 04:47:10 PM (7 years ago)
Author:
SergeyBiryukov
Comment:

Replying to hereswhatidid:

then $taxonomy_list would contain an array of just the term names.

That would print taxonomy names, but not term names. You can, however, use strip_tags() to get rid of links:

$taxonomies = array_map( 'strip_tags', get_the_taxonomies() );
echo implode( ' ', $taxonomies );

Looks like 27238.diff is made against 3.8 rather than current trunk, so it cannot be applied properly.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27238

    • Property Version changed from trunk to 3.8
  • Ticket #27238 – Description

    initial v2  
    11Currently get_the_taxonomies() automatically wrap all taxonomies that they list in anchor tags:
    2 
     2{{{
    33$links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";
    4 
     4}}}
    55We would like to have the option to remove these, to display an unlinked list of taxonomies that are applied to a post:
    6 
     6{{{
    77$list[] = $term->name;
    8 
     8}}}
    99The patch that I've attached includes a 'links' parameter to both the_taxonomies() and get_the_taxonomies(), set to true to not affect existing usage of these functions. If the parameter is set to false, only the taxonomies will be returned, and not their links.