WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I am using a custom post type to create a listing of businesses. Each post made, contains information about each business. The title of each post is the name of the business.

When I go to the menu created by the custom post type, I receive a standard listing of posts. (or in this particular case, a listing of business names). The posts show in a random order (or possibly being sorted by date on default?)

How can I allow for my posts to be listed in alphabetical ascending order by default?

share|improve this question
up vote 3 down vote accepted

You should use pre_get_posts:

function wpse56753_businesses_default_order( $query ){
    if( 'business' == $query->get('post_type') ){
        if( $query->get('orderby') == '' )

        if( $query->get('order') == '' )
share|improve this answer
Perfect. Works like a charm. Thanks. – Michael Ecklund Jun 28 '12 at 0:31
@MichaelEcklund It's Stephen, what do you expect? :-) – its_me Jun 28 '12 at 2:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.