Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#14590 closed defect (bug) (fixed)

get_queried_object_id does not return an int for taxonomy terms

Reported by: GamajoTech Owned by:
Priority: normal Milestone: 3.1
Component: Taxonomy Version: 3.0.1
Severity: minor Keywords: has-patch needs-testing gsoc
Cc: Focuses:

Description

The docblock for get_queried_object_id() claims it returns as an integer. However, when the queried object is such that is_tax() as true, it's returned as a string.

The following line (currently line 2739 of wp-includes/query.php in WP 3.0.1) needs changing within get_queried_object() from:

$this->queried_object_id = $term->term_id;

to

$this->queried_object_id = (int) $term->term_id;

Attachments (1)

14590.diff​ (541 bytes ) - added by wojtek.szkutnik 16 years ago.

Download all attachments as: .zip

Change History (8)

#1 @wojtek.szkutnik
16 years ago

  • Cc wojtek.szkutnik@… added
  • Keywords has-patch needs-testing gsoc added; taxonomy get_queried_object removed

Clearly someone must have forgotten the (int) part. I double checked the rest of the code, it seems it's the only place where the problem appears.

#2 @scribu
16 years ago

  • Severity normal → minor

#3 @GamajoTech
16 years ago

  • Cc gary@… added

Thanks for taking a look and attaching a patch (I really should learn how to do that, especially for something so trivial!).

#4 @nacin
16 years ago

  • Milestone Awaiting Review → 3.1

#5 @nacin
16 years ago

  • Resolution → fixed
  • Status new → closed

(In [16542]) Cast term_id to int for queried_object_id. props wojtek.szkutnik, fixes #14590.

#6 @scribu
16 years ago

(In [16543]) Minor cleanup in queried object setting logic. See #14590

#7 @scribu
16 years ago

(In [16544]) Remove debug cruft from [16543]. See #14590

Note: See TracTickets for help on using tickets.