1

Installed a plugin that allows the re-ordering of posts from any post type / category / tag using a drag/drop interface.

After some time of using, my post order went haywire and new posts began to appear in a jumbled order. The plugin's native reset button resolved this, but the old posts are still jumbled (only for two particular categories).

Plugin author suggested updating menu_order to 0 only for the post type in question and I have a few questions:

  1. I can't seem to find the appropriate field, which table would I look in?
  2. Post types just cover posts, pages and all custom post types, right? If I'm only having this issue with a category, I still have to reset the menu_order of the entire parent post type?
  3. I see the menu_order filter in the Codex, but I thought this was only for top level menu order, not the order of actual posts?
  • 2
    This is a SQL/PHPMyAdmin question, not a WordPress question. (There are on-topic elements of this question; please revise to focus on the WordPress-specific elements of your issue). – Chip Bennett May 1 '13 at 15:22
  • The parts about correcting the jumbled menu order and about how the menu_order column in the *_posts table works is on topic, which is most of the question, even if the fix is a quick query via PhpMyAdmin. – s_ha_dum May 1 '13 at 15:44
  • If the answer is "use this SQL query", then the question is off-topic. But, the focus of the question can be changed, such that your on-topic answer applies. I'm hoping the OP will update the question accordingly. – Chip Bennett May 1 '13 at 15:47
  • Doesn't the fact that I'm asking about Wordpress-specific database structures make this a Wordpress question? I mean, I'm asking about table structure specific to Wordpress — something someone familiar with Wordpress would be able to best advise on. That being said, should I just adjust the title of this question? – Orun May 1 '13 at 16:40
  • 1
    Another issue is that you're essentially asking three different questions, as one. – Chip Bennett May 1 '13 at 16:59
4

This piece of mySQL code should do the trick. Go into PHPmyAdmin, click the SQL tab and paste this code:

UPDATE wp_posts SET menu_order = 0 WHERE post_type = 'my_post_type';

This should set menu_order for all posts of the post type of your choice to 0.

2

menu_order is one of the columns in the *_posts table. In my dev database it only seems to be used for the nav_menu_item post type, but I haven't looked into it very carefully.

I am not sure about the connection to your categories. When I add a category, it is added to the menu as a nav_menu_item. Presumably that is how things work on your site too, unless someone has done something weird.

I don't think that altering that value will break anything. When I tested the menus just reordered but that is it. Make backups and test it on dummy data first.

  • 1
    'menu_order' is used by both the nav_menu_item post type, and the page post type - the latter, when returning wp_page_menu() or wp_list_pages() if the 'sort_column' parameter is set to 'menu_order'. I'm honestly not sure how categories are factoring into the OP's issue. – Chip Bennett May 1 '13 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.