Thank’s anmari,
A tad over my level of php knowledge, but manage to sort it out looking at it in another way. Sorted with changing the “global $submenu” and the code:
/**
* Makes the "All" sorting and "publish" default on edit screen for custom post types
*/
function default_post_sorting(){
global $submenu;
// Administrator users don't need this, bail out
if( current_user_can('add_users') )
return;
//'publish' default
$submenu['edit.php?post_type=my_post_type'][5][2] = 'edit.php?post_status=publish&post_type=my_post_type';
//'All' default
$submenu['edit.php?post_type=my_post_type'][5][2] = 'edit.php?post_type=my_post_type&all_posts=1';
}
add_action( 'admin_menu', 'default_post_sorting');
Just change “my_post_type” to your posttype.
Related Posts:
- Update post counts (published, draft, unattached) in admin interface
- Removing any and all inline styles from the_content()
- Removing filter dropdown in posts table (in this case Yoast SEO)
- Get old values for post before saving new ones
- How does filter the_posts work?
- How to publish a post with empty title and empty content?
- How to add a “publish” link to the quick actions
- Why is wordpress removing some unicode characters (e.g. some emojis) when I save my post?
- How to remove_filter that filters iframes in posts? [duplicate]
- Filter posts by author and category simultaneously
- Filter post before *editing*
- Filter/Remove HTML Elements on all posts and pages
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- If specific user role then sticky post
- Getting post id from wp_insert_post_data function?
- the_posts filter been called multiple time
- Filter Posts By Tag
- Custom excerpt length filter doesn’t work
- How can i do something after head like adding a hook for after head but before post
- Only display posts after current date
- Amend wordpress password function
- Custom Post Templates
- How can I remove posts of a certain category from homepage after a specified time period?
- How to generate numbers indistinguishable for the IDs of the posts
- Modify WP_Post before processing
- How to filter posts that belong to a specific category only if that is the only category
- How to retrieve the postID in a “image_send_to_editor” hook function?
- How to add Tags Filter in wordpress admin dashboard
- pre_get_posts query between 2 dates (date stored in custom post meta)
- Applying $posts_clauses filter to specific queries only
- Admin Posts Table Column Fitlering is not working for Custom Post Type
- Modify Image Source With The_Content Filter?
- What is the filter or hook to add admin controls to posts on the front end?
- Change post order random through out the entire WordPress
- use wpml_post_language_details function other plugin based on $post->ID [closed]
- Add filter by custom field to block of posts
- Ajax post filters not working
- Display Meta Values in Custom Filter – Admin Custom Posts
- How to filter my search in post if contains a word in title, content or excerpt?
- More then one menu items are assigned with “current-menu-item” class
- Update post_content everytime a custom post is opened in backend
- Posts and Attachments with “Published” status in Search
- How to allow visitors to filter posts by multiple taxonomies
- Trying to alter the post_content through the_post
- add to end of post in the loop with plugin
- Add filter to the end of the post
- Get post content with all filters applied, knowing post id
- Adding bootstrap classes to video shortcodes
- Is it possible to filter the main loop to exclude posts from a specific category?
- query post limits
- Modify posts listing at back end
- Prevent posts with certain post_meta to be edited
- Hook for changing excerpt content when excerpt not set
- Post filtering is returning blank page
- How include css class based on post ( in loop ) slug?
- Restrict displaying posts to the poster itself (in Back-end)
- Exists filter or action that change Add New Post link?
- changing parent_id on post
- Get current taxonomy and display query accordingly
- Trying to exclude custom posts based on date, while sorting by custom field
- can’t modify post title using the_posts filter
- Show only posts with titles/permalinks that do not contain certain words
- How do I display main query posts in random order using add_filter
- Rewrite image links from attachment id to attachment link
- user_has_cap filter allows “edit_others_posts” but not is not allowing updating/publishing
- Using AJAX to filter posts without refreshing page
- Filter posts by month (dropdown)
- Restricting displayed posts to posts from only select authors
- the wp_post_update isn’t working all the time
- Display/Filter post using if else statement
- How to add a custom class attribute into code wrapper? [duplicate]
- Filtering private Posts
- how to filter posts by category without page load (ajax) in wordpress?
- Remove status ‘archived’ from the default post and page view
- Dropdown Select Post Filter
- long-title posts do not want published
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- How do i search post by jquery datepicker?
- show only one category and filter by tag
- Prevent WordPress from putting around specific element
- filter buddypress users posts by user ‘xprofile’ custom fields
- Override wp_link_pages pagebreak with filter
- How do I change the post title’s link on the posts page?
- How to create frontend Post filter using meta query
- Printable Page with all Posts from Tag
- How to test if user is filtering post list in dashboard
- Hide Admin posts & pages in Dashboard
- Is it possible to completely replace a post with an action/filter?
- Extracting a TLD from the content and assign to custom field
- How to get the postID inside ‘content_save_pre’? Other hook?
- Filter question list on substring of metavalue
- Add review box by function at top or bottom of content
- Get results from the main wp_query
- Keep post format class with isotope filter
- Custom filter on all post page (admin backend)
- How to use in_category?
- the_content() not displaying the full post
- wp_query posts sorting doesn’t work
- Add custom PHP (no-SQL) filter to WP_query
- Filters do not work when there are multiple (one works)