Roll sticky posts into MySQL query
|Reported by:||martinshopland||Owned by:|
The way that WP currently queries for sticky posts is quite long winded and prone to error. Sticky posts output behaviour is erratic when using pagination or ordering. I suggest that the sticky posts feature would be better served by being rolled into the MySQL query rather than trying to reconstruct the result set after the main query has run.
I have tested the attached patch against 3.4.2 and it works as expected. The query additions are performed on every page of home, rather than just the first, so that page boundaries behave as expected and that the sticky posts don't appear on subsequent pages. ignore-sticky-posts is honoured.