Make WordPress Core

Opened 4 years ago

Closed 8 months ago

#14448 closed enhancement (duplicate)

get_terms(): Add "slugs" option for $fields

Reported by: wjm Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Taxonomy Keywords: has-patch
Focuses: Cc:


This patch allows get_terms to return an array of term slugs (same as for "names" but with slugs).


print_r( get_terms( 'event', array( 'fields'=>'slugs', 'hide_empty'=>0, ) ) );

will return

    [0] => concerts
    [1] => talks
    [2] => training
    [3] => workshops

Attachments (2)

get_terms.patch (735 bytes) - added by wjm 4 years ago.
14448.patch (773 bytes) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (7)

wjm4 years ago

comment:1 nacin3 years ago

  • Milestone changed from Awaiting Review to Future Release

comment:2 Hekos2 years ago

  • Cc Hekos added
  • Version changed from 3.0 to 3.3

This enhancement is related to #15835 [18603] and should be added for consistency.

SergeyBiryukov2 years ago

comment:3 SergeyBiryukov2 years ago

  • Version changed from 3.3 to 3.0

Refreshed the patch.

Version field indicates when the enhancement was initially suggested.

comment:4 wonderboymusic8 months ago

  • Milestone changed from Future Release to 3.7

Patch still applies

comment:5 wonderboymusic8 months ago

  • Milestone 3.7 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Actually, scratch that. #13661 has the more useful ids=>slugs

Note: See TracTickets for help on using tickets.