Post list in admin (edit.php) use a normal WP_Query
, just like frontend can be changed using pre_get_posts
.
add_action('pre_get_posts', 'reorder_my_cpt');
function reorder_my_cpt( $q ) {
if ( !is_admin() || !$q->is_main_query() ) {
return;
}
$s = get_current_screen();
// change 'book' with your real CPT name
if ( $s->base === 'edit' && $s->post_type === 'book' ) {
$q->set('orderby', 'menu_order');
$q->set('order', 'ASC');
}
}
Related Posts:
- How to add an admin notice upon post save/update
- How to Change Order of Posts in Admin?
- Get current menu_order
- Different post sort order within different categories
- Change label of title field for posts in the backend
- what types of order can I pass to get_posts() via orderby?
- Sort posts by popularity/page views
- Exclude drafts in all() view of edit.php
- How to Arrange Posts by Size in the WordPress Dashboard?
- How do I reorder (pop and push) items from WP_Query?
- List latest posts in WP-Admin
- How to put last edited entry on top of the blog-post list?
- Sort post by attributes ‘order’
- Open WordPress ‘Add New Post’ admin page with parameters set via $_GET
- using slug instead of ID in admin edit post url
- How to sort posts by last name (2nd word) on ONE category only?
- Query posts from current year
- Reverse chronology of post listing
- Categories box not showing on post edit pages
- Increment Page Order As Pages Are Created
- Include Sticky Post in Page Posts Count?
- Order Posts by Alphabetical for Each Letter
- Set number of article per number of page
- Make “Post published. View post” Open in a New Tab
- Problem ordering posts with numbers for titles numerically E.g. 1, 10, 100
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- How to get new post URL?
- Order post by year DESC and month ASC
- Display custom post types by date field
- How to remove bulk edit options
- Add confirmation popup on “Move to Trash”
- Embed WordPress Admin in an iframe
- Can’t publish, edit or delete posts since Gutenberg update
- Send email to user that his post has been rejected
- Add filter-by-tag in the all posts admin console page
- Remove some articles from the list in WPAdmin for a user
- How to place HTML below the title of the (custom) post overview
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- Some blog posts containing source code fail to save draft or publish
- WP_Query outputs wrong post in custom post type
- Edit post & page option does not display on latest wordpress
- Cannot create new posts or upload images using media manager
- Automatic duplicate/copy of post to a related page in WordPress
- user_has_cap filter allows “edit_others_posts” but not is not allowing updating/publishing
- ‘QTags.addButton: arg2 distorts the button rather than just shows
- Custom Fields – How to get the list of a specific active widget each time it rendered
- My page shows some other content in WP
- the wp_post_update isn’t working all the time
- Redirect old Posts URL to new URL
- Post count doesn’t match number of posts shown in list in admin
- How to view a post from the wordpress admin screen
- Blog open in new Tab
- query posts with selected post ids first
- Remove status ‘archived’ from the default post and page view
- Strange behaviour in WordPress admin
- How to show WP admin edit page within template page/post?
- WordPress Screen Options, Help, Visual editor, Status, Visibility, Revisions, Published on and any toggled indicator don’t work for posts
- Many buttons not functioning in WordPress dashboard (as admin)
- Redirecting to “All Posts” after post publish or update
- How do I display posts ordered by a date custom field?
- WP_Query sort by meta_value_num or date
- Set featured image on creating new post
- Blank page after changing number of post displayed in wp-admin
- Allow reader to reorder posts for themselves (oldest first)
- How to sort posts in admin by name
- Random order of the 5 most popular posts
- My custom query is displaying random posts in random order
- Is it possible to display QUICK EDIT as default for all posts in wp-admin/edit.php page?
- How can I filter the post of a CPT by taxonomy Term in admin meta-box dropdown?
- Get query result according to merged array
- issue in wordpress auto delete post and redirect to another 1
- How to enable comments meta box for other author posts?
- Admin is showing all posts on page 1
- How to make post button to a random post
- Post preview in iframe without saving the post
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- Where is object, property or label in the database that controls the order of the posts being displayed?
- How to change the publishing date of each posts?
- Last three posts not being put in order by date. How to fix this?
- Error establishing a database connection
- Order by ‘s’ using WP_Query()
- Post thumbnail is not shown in wp-admin
- Creating a new Sortable Column in WordPress Admin
- Enqueue CSS on custom posts’ backend area
- What does WordPress mean by they have full rights to content [closed]
- Add News Feed to bespoke website, only to one page on whole site
- Post Format Status [closed]
- Custom Admin Post Column change order
- Display posts with id equal to relationship value
- I cannot see the pagination in /wp-admin posts page
- How to sort posts alphabetically based on a specific parent category
- editPost without undo entry
- My website freezes for one minute every time I publish or update a post
- Post type gives 404 unless logged in
- Set Featured Image of a post
- /wp-admin/admin-ajax.php Error 500 while using divi premade layout in existing pages
- Mismatch between posts count and actual list in admin posts page
- Order by Post Title in WP Query not working
- How to restore post to pending status (no draft)
- How to add publish button in menu All Posts (Wp-Admin)