[wp-trac] [WordPress Trac] #15773: Lazy load $wp_query->is_singular (was: Replace $is_singular with is_singular())

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 20 20:00:01 UTC 2011


#15773: Lazy load $wp_query->is_singular
----------------------------+-----------------------------
 Reporter:  scribu          |       Owner:  markjaquith
     Type:  enhancement     |      Status:  reviewing
 Priority:  normal          |   Milestone:  Future Release
Component:  Query           |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  php5 has-patch  |
----------------------------+-----------------------------

Old description:

> The $is_singular flag is just an alias for {{{$is_post || $is_page ||
> $is_attachment.}}}
>
> Being a variable means we have to also keep it current whenever one of
> it's components changes.
>
> I propose we use the is_singular() method, and deprecate $is_singular.

New description:

 The $is_singular flag is just an alias for {{{$is_post || $is_page ||
 $is_attachment.}}}

 Being a variable means we have to also keep it current whenever one of
 it's components changes.

 I propose we use a magic {{{__get()}}} method that would call
 is_singular() internally.

--

Comment (by scribu):

 Similar: #17195

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15773#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list