One of the long-awaited new features of WordPress 3.0 is custom post types.
By default, custom posts with the post capability_type (as opposed to page, attachment, revision, or nav-menu-item) are listed newest to oldest in the WordPress backend. This makes sense if these are blog posts, but if they are some other content type (such as quotes, movies, books or contacts) it is often desirable to have them listed alphabetically.
To achieve this, add the following code to your functions.php file, replacing POST_TYPE (line 7) with the name of the post type that you want to have listed alphabetically.
function set_custom_post_types_admin_order($wp_query) {
if (is_admin()) {
// Get the post type from the query
$post_type = $wp_query->query['post_type'];
if ( $post_type == 'POST_TYPE') {
// 'orderby' value can be any column name
$wp_query->set('orderby', 'title');
// 'order' value can be ASC or DESC
$wp_query->set('order', 'ASC');
}
}
}
add_filter('pre_get_posts', 'set_custom_post_types_admin_order');

