Make WordPress Core

Opened 15 years ago

Closed 12 years ago

#14448 closed enhancement (duplicate)

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

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

Description

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

Usage:

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

will return

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

Attachments (2)

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

Download all attachments as: .zip

Change History (7)

@wjm
15 years ago

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @Hekos
13 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.

#3 @SergeyBiryukov
13 years ago

  • Version changed from 3.3 to 3.0

Refreshed the patch.

Version field indicates when the enhancement was initially suggested.

#4 @wonderboymusic
12 years ago

  • Milestone changed from Future Release to 3.7

Patch still applies

#5 @wonderboymusic
12 years 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.