WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#14015 closed enhancement (fixed)

Wrappers for get_queried_object() and get_queried_object_id()

Reported by: filosofo Owned by: filosofo
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords: has-patch commit
Focuses: Cc:

Description

I am frequently writing

$GLOBALS['wp_query']->get_queried_object()

and

$GLOBALS['wp_query']->get_queried_object_id()

We have wrappers for other WP_Query methods; these seem like obvious candidates.

Patch replaces the above with the following, respectively:

get_queried_object()

and

get_queried_object_id()

Attachments (1)

get_queried_object_wrapper.14015.diff (919 bytes) - added by filosofo 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 filosofo4 years ago

  • Owner set to filosofo
  • Status changed from new to accepted

comment:2 nacin3 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Triage to 3.1

comment:3 filosofo3 years ago

Patch still applies cleanly.

comment:4 ryan3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [16091]) get_queried_obecjt() and get_queried_object_id(). Props filosofo. fixes #14015

comment:5 scribu3 years ago

(In [16114]) use get_queried_object() wrappers throughout. See #14015

Note: See TracTickets for help on using tickets.