[wp-trac] [WordPress Trac] #14115: sticky posts - query.php optimization

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 27 17:33:59 UTC 2010


#14115: sticky posts - query.php optimization
-------------------------+--------------------------------------------------
 Reporter:  michelwppi   |       Owner:                
     Type:  enhancement  |      Status:  new           
 Priority:  normal       |   Milestone:  Future Release
Component:  Query        |     Version:  3.0           
 Severity:  minor        |    Keywords:                
-------------------------+--------------------------------------------------
Changes (by scribu):

  * severity:  normal => minor
  * component:  General => Query
  * milestone:  Awaiting Review => Future Release


Old description:

> Making improvements in plugin xili-language
> [http://wordpress.org/extend/plugins/xili-language/], I use filter for
> get_option('sticky_posts')... and to find the right translation of sticky
> posts for each home language (demo shown here
> [http://multilingual.wpmu.xilione.com/] ).
> The call is at line 2473 of query.php. and done '''every time but only
> used if is_home is true'''.
> To optimize I propose that this call of get_option can be encapsulated
> inside if condition as suggested below
>
> {{{
> if ($this->is_home) {
> get_option('sticky_posts');
> if ( $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) &&
> !$q['caller_get_posts'] ) { /////
> }
> }
> }}}
>
> It is microseconds for server but useful for hooking functions etc,
> etc...
>
> Michel
> dev.xiligroup.com

New description:

 Making improvements in plugin xili-language
 [http://wordpress.org/extend/plugins/xili-language/], I use filter for
 get_option('sticky_posts')... and to find the right translation of sticky
 posts for each home language (demo shown here
 [http://multilingual.wpmu.xilione.com/] ).
 The call is at line 2473 of query.php. and done '''every time but only
 used if is_home is true'''.
 To optimize I propose that this call of get_option can be encapsulated
 inside if condition as suggested below

 {{{
 if ($this->is_home) {
 get_option('sticky_posts');
 if ( $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) &&
 !$q['caller_get_posts'] ) { /////
 }
 }
 }}}

 It is microseconds for server but useful for hooking functions etc, etc...

--

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


More information about the wp-trac mailing list