Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#11966 closed defect (bug) (fixed)

Sticky posts not removed from query results when pushed to front of posts

Reported by: jeffstieler Owned by:
Priority: normal Milestone: 3.0
Component: General Version: 2.9.1
Severity: normal Keywords: has-patch tested
Cc: Focuses:

Description

array_search() is being used to determine the offset of a processed sticky post in the query results, and array_splice() is being used to remove it from the queue.

array_search() returns the key for the sticky post, and array_splice() expects a numerical index

If the key returned by array_search() does not match the sticky post's actual offset in the array, it is not removed and appears as a duplicate.

Attachments (1)

query.php.diff​ (434 bytes ) - added by jeffstieler 17 years ago.

Download all attachments as: .zip

Change History (3)

#1 @prettyboymp
17 years ago

  • Keywords tested added
  • Milestone Unassigned → 3.0
  • Version → 2.9.1

Confirmed.

To test, add a filter to 'option_sticky_posts' that returns the array with keys set, ie; apply something like array_diff() to the sticky_posts array.

#2 @nacin
17 years ago

  • Resolution → fixed
  • Status new → closed

(In [14135]) Fix sticky post handling. Use unset instead of array_splice to remove an item by key retrieved by array_search. props jeffstieler, fixes #11966.

Note: See TracTickets for help on using tickets.