Try…
add_filter("posts_orderby", "my_orderby_filter", 10, 2);
function my_orderby_filter($orderby, &$query){
global $wpdb;
//figure out whether you want to change the order
if (get_query_var("post_type") == "my_post_type") {
return "$wpdb->posts.post_title ASC";
}
return $orderby;
}
Related Posts:
- Using meta_query, how can i filter by a custom field and order by another one?
- query_posts with a custom post type, a meta_query and sorting by post date?
- Sorting multiple custom post types without a meta key/value pair by sort order
- Sorting the Loop by Taxonomy Value
- How do I query a custom post type with a custom taxonomy?
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- what is the correct way to compare dates in a WP query_posts meta_query
- How do I set the default admin sort order for a custom post type to a custom column?
- How to get post content by calling ajax?
- Make custom column sortable
- How to show all posts of the category in wordpress?
- Get the ID of the latest post
- Return all custom meta data for one custom post type
- Display a query with multiple post types and same relationship on a single page
- group search results by post type?
- register_post_type sort order by title by default
- Fail to compare dates in meta_query
- How to filter custom posts by tags and custom fields?
- Order by & include array by specific post ids
- How to call a custom post with get_posts() instead of query_posts()?
- Drag n Drop Post Order for multiple Custom Post Types
- Sort custom post type list table by display name of a user id stored as post meta value
- Custom sortable columns ordered by meta-value?
- Custom post type archive 404’s with paginate_links
- How to order adjacent posts (prev / next) by custom field value?
- WordPress post sorting with AJAX
- Ordering posts by custom taxonomy in admin area
- Custom Post Type, WP_Query and ‘orderby’
- Filter admin columns by custom post field value
- Sorting a query by custom field date
- Custom Taxonomy Template Post List with Sort Order
- Ordering Posts List By Taxonomy Terms?
- Column sorting with emtpy meta values
- Number of pages – multiple (custom) post types
- Display Custom Post Type Fields
- Querying custom posts and regular posts
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- Limit the post for differents custom post type in the same wp_query
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- how to sort post in admin column by recently
- Custom Post type sort order not working in the admin area
- Retrieving 3 latest post from each of 5 different custom post types
- How to hook get_terms() to only show count of posts that have custom meta
- How to sort a table of custom posts by column containing custom field
- Using Offset in Custom Post Type Query
- how to group custom post type posts by custom taxonomy terms
- order by meta_value serialized array
- Posts per Page on custom Taxonomy Template
- Using Query Posts With Multiple Post Types And A Taxonomy
- How to get the parent’s taxonomy?
- Loading post content in FancyBox
- Query posts by custom post type and custom taxonomy
- Alphabetical sorting of custom post type – one letter per page
- sort events based on event date custom field
- How to Sort Custom Field Admin Column by Date
- How to Sort by Date When Using d-m-Y Format
- Multiple templates for custom post type
- Query post types with multiple keys
- ascending order custom post type
- posts_nav_link on single post template
- Query not returning CPT posts
- Post Rank on Single Post page based on custom field
- How to get only one category of custom post type?
- Used with meta_query in query_posts works slowly
- Unable to display multiple post types in same query (WPML WP_Query)
- pre get posts changing the query
- Query for posts in 2 taxonomies
- Prevent change with new query_posts()
- How to make an archive page displaying posts in a date range
- Get permalink and title by post name?
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Sort Posts Best Practice
- Get all posts WHERE custom_field is LIKE value
- Quickest way to get last or oldest post date – WP Query
- How to display recent posts added in several custom post types
- How to add new tab to admin list of posts and handle result list
- ‘category__and’ for custom taxonomy?
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Sort by two dates. Default entry date and custom field if present
- Display custom post types with custom date field value (before today) & order by custom date field
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- How do I sort a custom post type admin column using two meta keys?
- Custom-post-type-archive: posts sorted/filtered by year?
- reference the current category being used in the category.php page
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- List custom post type by custom tax term as page title
- How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?
- sort order for a custom post-type [closed]
- Sort admin area by custom Event Date field
- Custom query shows custom post types in trash
- Multiple post type queries (with specific arguments for each)
- Combine query_posts() and get_posts() into single query
- how can i get posts from custom post type particular taxonomy category
- Setting posts per page in query_posts
- How to insert content from another Custom Post type into Post?
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- Custom post type ‘orderby’ => ‘meta_value’ not working
- Sort by custom field is not working
- How to rank custom post type from score points