Sort posts on-the-fly without making a new SQL query
As of April 2026, Sort Query Posts is a WordPress post plugin with 100 active installations and a 5/5 rating from 3 reviews. It has been downloaded 11K+ times in total. Requires WordPress 2.5+ and PHP false+. Available on WordPress.org since 2011. Last updated 13 years ago — may have compatibility concerns. Top alternative: Header and Footer Scripts.
A really simple and lightweight plugin (73 lines of code – comments included) to sort posts on-the-fly without making a new query to the database (improves performance).
order_by and order values of the query_posts function except meta_value and meta_value_num (which require a database query).This plugin adds the function sort_query_posts_by(string $order_by [, string $order]) to the global context.
The second $order parameter is optional. Its default value is asc (ascending order).
Call this function before the loop to change how posts are ordered.
After calling this function you can show the posts as you norma…
| WordPress | 2.5+ requiredTested up to 3.4.2 |
| PHP | false+ required |
Plugin data sourced from WordPress.org. Analysis and metrics by PluginSift.