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
- ACF – Tags not showing up in Custom Post Types
- A developer set a ‘standard format’ for my blogposts on wordpress but i need to remove it, how?
- How can I create a custom meta box to add an mp4 video to a page?
- Custom post type ‘orderby’ => ‘meta_value’ not working
- Need help targeting a custom post type with conditional tags
- How to get the post type from a category id?
- How to rank custom post type from score points
- Delete link on single-custom.php with redirection
- How to structure a site with product variations pages?
- Notice: Undefined index: suppress_filters
- CPT: if more than X images are in post, use pagination
- How to Separate CPT From Regular Posts?
- Remove rows in the manage post/page view
- Sorting multiple custom post types without a meta key/value pair by sort order
- Getting rid of /my_custom_post_type/ in the single view URL
- Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
- Custom Post Type – List all attachments on Edit Screen
- Order By Post Type ThenBy Taxonomy
- How to create custom boxes with text inside?
- Combining sorted and random CPT
- How to add post_type=value when editing that post type in the WordPress admin?
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Open Custom Post Type as PDF
- Using The REST API How To Pull All Custom Posts?
- Group posts by custom post type
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Custom Page that comes with preloaded content for the user
- How inefficient is it to use a Custom Post for 4-5 sentences & pull all to 1 page?
- Add acf field in title (admin table)
- Show the same Article Available in Other Categories
- Getting posts under the custom post type ui category
- Sorting custom post type columns with external data and without meta values
- Storing posts from query and accessing later via AJAX call
- How to check post type (to include custom css)