You should use pre_get_posts
:
add_action('pre_get_posts','wpse56753_businesses_default_order');
function wpse56753_businesses_default_order( $query ){
if( 'business' == $query->get('post_type') ){
if( $query->get('orderby') == '' )
$query->set('orderby','title');
if( $query->get('order') == '' )
$query->set('order','ASC');
}
}
Related Posts:
- What does this PHP function code mean? [closed]
- Restrict custom post type to only site administrator role
- Linking Two Post Types
- How to force one column layout on custom post type edit page?
- Sort custom post type list table by display name of a user id stored as post meta value
- How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?
- WP_List_Table Inside Metabox Not Working on Submit
- Redirect after deleting post and keep track of pagination
- modify all posts of a category to “no comments allowed”
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- Showing current taxonomy terms
- automatically create taxonomy with same name as post title
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- Query post types with multiple keys
- [Plugin: Posts 2 Posts] Changing display order of connections
- same archive template for different custom post
- Get all posts WHERE custom_field is LIKE value
- Get the post children count of a post
- How to delete all posts from a custom post type?
- Check Title Unique Or Not and If not error message and dont save
- Remove All, Published and Trashed Post Views in Custom Post Type
- How to post twitter like updates on wordpress
- Show Two custom Post type and their posts on category page
- apply filters only to specific post listing without check the url parameters
- Custom post type and body_class: Remove “blog” class
- Deleting Custom Post type data using mySQL command
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Display only one post each WEEK
- Default sort on admin columns with meta date hides draft posts with empty date value
- List custom taxonomy specific to one custom post type
- Meta query for custom post type ignored in main query
- Show titles, date of all posts on single category page
- WooCommerce sort products by the actual product width(not the shipping width)
- Update postmeta Parent when post_status child change
- Allow users to create posts without logging in?
- Get_the_terms restrict output
- Custom post type menu
- YOAST SEO won’t work on custom post type archive [closed]
- Separate Content from gallery (custom post type)
- WordPress Count posts within a custom post type
- Custom post type tags not showing in search
- How set template for “custom post type” individual post
- Why is my custom post content only viewable when signed into WordPress?
- Adding specific custom fields (images) to post excerpt
- Using Orderby and meta_value to order natural/alphanumerical
- Limit posts per page depending on the size of a div?
- Delete Post by User
- creating a custom post template
- Problem to get the link of the default ‘post’ post type like the orther custom types
- One Post with different content, depending on a Page
- Custom Post Type
- Display all post types together
- Turn post into simple slideshow
- Query multiple post of which one by taxonomy
- How to make a template for a specific post of a custom post type?
- How to delete unnecessary custom post types in the UI
- How to create a job post by email parsing? [closed]
- show posts under custom post type with same autj
- How to automate the creation of advanced layout article/post
- display posts, pages and custom post types from another wordpress site
- Sort CPT by taxonomy AND THEN by custom field
- is therer any wordpress function to retrieve a specific html element from post content
- How to develop Knowledge center in WordPress Website
- WordPress REST Create Post of Custom Type
- remove_action conditionally for Custom Post Type
- Row actions not showing? Why?
- Slug for standard post post_type
- How do I create an archive page for standard posts?
- Remove parent from custom post type
- WordPress if in term*
- CPT: if more than X images are in post, use pagination
- Combining sorted and random CPT
- How to add post_type=value when editing that post type in the WordPress admin?
- Open Custom Post Type as PDF
- Prioritize posts in query by meta keys?
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- wp_insert_post wrong post type [closed]
- How to display custom field value on page?
- WordPress custom API endpoint – how to make the request more flexible
- display posts of custom post type with custom taxonomy
- creating files for displaying different custom post type posts with paging
- is it possible in a custom post, create custom fields as well whitin?
- Display author box on just certain category posts?
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Custom loop request based on custom field
- Custom post type order by post_title
- WordPress retrieving $post based on random key in $_POST
- Post display in separate page [duplicate]
- Only show current category post
- WordPress Contents Migration
- Getting wrong ID
- How to make post page unique and show it on home page?
- Query Posts From Multiple Post Types
- How to hide home title on pages and posts?
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Creating post custom field text area
- How Do I Add a Custom Post Type URL to Content?