WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 20 months 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 4 years ago.
changes based on is_category() function
18746.diff (1.5 KB) - added by wonderboymusic 21 months ago.
18746.2.diff (2.6 KB) - added by wonderboymusic 20 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 @scribu4 years ago

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

@ramiy4 years ago

changes based on is_category() function

comment:2 @ramiy4 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

comment:3 @iseulde21 months ago

  • Component changed from General to Taxonomy

comment:4 @ramiy21 months 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 21 months ago by ramiy (previous) (diff)

comment:5 @ramiy21 months 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

@wonderboymusic21 months ago

comment:6 @wonderboymusic21 months ago

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

Fixed whitespace and fuzz

comment:7 @ramiy21 months ago

Thanks!

@wonderboymusic20 months ago

comment:8 @wonderboymusic20 months 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.