Make WordPress Core

Opened 11 years ago

Closed 8 years ago

#14115 closed enhancement (duplicate)

sticky posts - query.php optimization

Reported by: michelwppi Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.0
Component: Query Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

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) { 
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...

Attachments (1)

sticky.diff (4.4 KB) - added by scribu 11 years ago.

Download all attachments as: .zip

Change History (4)

11 years ago

#1 @scribu
11 years ago

  • Component changed from General to Query
  • Description modified (diff)
  • Milestone changed from Awaiting Review to Future Release
  • Severity changed from normal to minor

#2 @scribu
11 years ago

  • Keywords has-patch added

#3 @wonderboymusic
8 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This is handled in the patch on #11950, closing this ticket

Note: See TracTickets for help on using tickets.