Force Search Results To Be In Alphabetical Order

By default, WordPress organizes posts within search results based on the post date.

You can easily override this by changing the OrderBy to Title.


function abc_search( $query ) {
	if( $query->is_search && !is_admin() ) {
		$query->set( 'orderby', 'title' );
		$query->set( 'order', 'ASC' );
add_filter( 'pre_get_posts','abc_search' );

Need Help?

Tell us about your project!

  • Date Format: MM slash DD slash YYYY
Previous Post
Turning Google Sheets Into WordPress Tables
Next Post
Setting Up G Suite

Related Articles

Google Rating
Based on 54 reviews
Get a Quote