How to Prevent New Posts from Appearing at the Top of Your Ordered List
Content
A common challenge for WordPress users managing ordered content is that newly published posts often jump to the top of the list, disrupting a carefully curated order. This article explains why this happens and outlines the most effective solutions to control where new items appear.
Why New Posts Appear at the Top
By default, the 'Post Types Order' plugin and WordPress itself assign a default menu_order value of 0 to any new post or page. When content is sorted by this menu_order field, all items with a value of 0 are grouped together. Since new items lack a defined order, they often appear at the top of the list in the order interface and on the front end, which can override your existing manual order.
Common Solutions
1. Use the 'Send new items to bottom of list' Option (Advanced Version)
The most straightforward solution is a feature available in the Advanced Post Types Order plugin. This option automatically assigns a high menu_order value to new posts, effectively sending them to the bottom of any list sorted by that field.
How to use it: After installing the advanced version, navigate to Settings > Post Types Order. Within the settings for your specific post type, you will find the "Send new items to bottom of list" checkbox. Enabling this option will ensure new posts are added to the end of your ordered list.
2. Custom Code Using the save_post Hook
For developers comfortable with code, a custom function can be written to automatically set the menu_order for new posts. This solution uses WordPress's save_post action hook to assign the new post the next available order number.
function set_new_post_order( $post_id, $post, $update ) {
// Only run for new, published posts of a specific type
if ( $update || 'publish' !== $post->post_status || 'your_post_type' !== $post->post_type ) {
return;
}
global $wpdb;
// Get the current maximum menu_order value for the post type
$max_order = $wpdb->get_var( $wpdb->prepare(
"SELECT MAX(menu_order) FROM {$wpdb->posts} WHERE post_type = %s AND post_status = 'publish'",
$post->post_type
) );
// Set the new post's menu_order to one more than the current maximum
$wpdb->update(
$wpdb->posts,
array( 'menu_order' => $max_order + 1 ),
array( 'ID' => $post_id )
);
}
add_action( 'save_post', 'set_new_post_order', 10, 3 );
Important: Remember to replace 'your_post_type' with the slug of your actual custom post type (e.g., 'post', 'page', 'product').
3. Manually Reset and Rebuild Order
If your order has become inconsistent, you may need to reset it and start fresh. This can be done directly in your database's wp_posts table.
Warning: Direct database manipulation should be performed with extreme caution. Always create a full backup of your database before proceeding.
- Access your database via a tool like phpMyAdmin.
- Locate the
wp_poststable. - Run an SQL query to reset the
menu_orderfor your specific post type to 0:UPDATE wp_posts SET menu_order = 0 WHERE post_type = 'your_post_type'; - After resetting, you can manually drag and drop items in the "Re-Order" interface to establish a new, correct order for all items.
Troubleshooting: When Order Changes on Post Update
Some users report that updating an existing post causes it to move to the bottom of the list. This is not the default behavior of the Post Types Order plugin. This issue is almost always caused by a conflict with another plugin or your theme, which is overwriting the menu_order value upon saving a post.
How to diagnose:
- Deactivate all other plugins except for Post Types Order.
- Update a post and check if the order is preserved.
- If the order is now correct, reactivate your plugins one by one, testing after each activation, until you find the one causing the conflict.
- If the problem persists with all plugins deactivated, try switching to a default WordPress theme (like Twenty Twenty-Four) to rule out a theme conflict.
By understanding the default behavior of the menu_order field and applying one of these solutions, you can gain full control over where new posts appear in your ordered lists.
Related Support Threads Support
-
New Posts overwrite Posts Orderhttps://wordpress.org/support/topic/new-posts-overwrite-posts-order/
-
Is it possible to pin specific posts?https://wordpress.org/support/topic/is-it-possible-to-pin-specific-posts/
-
Reverse order in new 3.8https://wordpress.org/support/topic/reverse-order-in-new-38/
-
Updating Posts Changes Orderhttps://wordpress.org/support/topic/updating-posts-changes-order/
-
Re-order sub-menu for pageshttps://wordpress.org/support/topic/re-order-sub-menu-for-pages/
-
Paginationhttps://wordpress.org/support/topic/pagination-238/
-
Add new posts to the bottom of the list instead of top?https://wordpress.org/support/topic/add-new-posts-to-the-bottom-of-the-list-instead-of-top/
-
New posts show up second in re-order list when publishedhttps://wordpress.org/support/topic/new-posts-show-up-second-in-re-order-list-when-published/
-
How to remove thumbnails from post list??https://wordpress.org/support/topic/how-to-remove-thumbnails-from-post-list/
-
menu_order starts at 0https://wordpress.org/support/topic/menu_order-starts-at-0/
-
Change Default Order to Alphabeticalhttps://wordpress.org/support/topic/change-default-order-to-alphabetical/
-
Programmatic controlling the menu orderhttps://wordpress.org/support/topic/programmatic-controlling-the-menu-order/
-
How to stop new posts automatically going to top of posts order?https://wordpress.org/support/topic/how-to-stop-new-posts-automatically-going-to-top-of-posts-order/
-
reset post types orderhttps://wordpress.org/support/topic/reset-post-types-order/
-
Random order ?https://wordpress.org/support/topic/random-order-9/
-
Add new posts at the bottom of the re-order menuhttps://wordpress.org/support/topic/add-new-posts-at-the-bottom-of-the-re-order-menu/
-
allow sticky post to take precedence over post type orderhttps://wordpress.org/support/topic/allow-sticky-post-to-take-precedence-over-post-type-order/
-
Re-order lines text height problem for title with tagshttps://wordpress.org/support/topic/re-order-lines-text-height-problem-for-title-with-tags/
-
Reordered post list changing after post update. How to stop that from happening.https://wordpress.org/support/topic/reordered-post-list-changing-after-post-update-how-to-stop-that-from-happening/
-
Reverse Orderinghttps://wordpress.org/support/topic/reverse-ordering/
-
Need additional information of post on Re-order screenhttps://wordpress.org/support/topic/need-additional-information-of-post-on-re-order-screen/
-
Display the order on the re-order pagehttps://wordpress.org/support/topic/display-the-order-on-the-re-order-page/
-
Retrieving a custom field to display next to the namehttps://wordpress.org/support/topic/retrieving-a-custom-field-to-display-next-to-the-name/
-
Front end post orderinghttps://wordpress.org/support/topic/front-end-post-ordering/
-
Update menu order when new post is createdhttps://wordpress.org/support/topic/update-menu-order-when-new-post-is-created/
-
Doesn't seem to reorder non sticky postshttps://wordpress.org/support/topic/doesnt-seem-to-reorder-non-sticky-posts-1/
-
Default sort order value to max+1?https://wordpress.org/support/topic/default-sort-order-value-to-max1/
-
shows repeat set of posts after re-orderinghttps://wordpress.org/support/topic/shows-repeat-set-of-posts-after-re-ordering/
-
Fixed positionhttps://wordpress.org/support/topic/fixed-position-12/
-
Make Certain Posts "Sticky"https://wordpress.org/support/topic/make-certain-posts-sticky/
-
How to limit number of posts?https://wordpress.org/support/topic/how-to-limit-number-of-posts/