WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#18746 closed enhancement (fixed)

Make WP_Query::is_tag() accept a term-name and term-id

Reported by: ramiy Owned by: wonderboymusic
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.3
Component: Taxonomy Keywords: has-patch needs-codex
Focuses: Cc:

Description

The is_category() function recieves as a parameter Category ID, Category Name or Category Slug.

So is the is_tax() function, it recieves as a parameter Term ID, Term Name or Term Slug.

But the is_tag() function can recieve only Tag Slug.

Attachments (3)

18746.patch (1.4 KB) - added by ramiy 5 years ago.
changes based on is_category() function
18746.diff (1.5 KB) - added by wonderboymusic 3 years ago.
18746.2.diff (2.6 KB) - added by wonderboymusic 3 years ago.

Download all attachments as: .zip

Change History (11)

#1 @scribu
5 years ago

  • Summary changed from Enhance the is_tag() function to Make is_tag() accept a term name

@ramiy
5 years ago

changes based on is_category() function

#2 @ramiy
5 years ago

  • Keywords has-patch added
  • Summary changed from Make is_tag() accept a term name to Make is_tag() accept a term name or term id

#3 @iseulde
3 years ago

  • Component changed from General to Taxonomy

#4 @ramiy
3 years ago

The patch fixes WP_Query::is_tag(), not the is_tag() function. It's based on WP_Query::is_category() to match the functionality.

Last edited 3 years ago by ramiy (previous) (diff)

#5 @ramiy
3 years ago

  • Keywords dev-feedback needs-codex added
  • Summary changed from Make is_tag() accept a term name or term id to Make WP_Query::is_tag() accept a term-name and term-id

@wonderboymusic
3 years ago

#6 @wonderboymusic
3 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 3.7

Fixed whitespace and fuzz

#7 @ramiy
3 years ago

Thanks!

#8 @wonderboymusic
3 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 25287:

Allow is_tag() to accept term_id, slug, 'term_name or array of any. Many other is_*()` funcs already do this. Adds unit tests.

Props ramiy.
Fixes #18746.

Note: See TracTickets for help on using tickets.