admin管理员组

文章数量:1128522

I want to use a custom menu from the wordpress database but I get the elements disordered and I want them to have the same order how can i do that? There is a place in the database where the order is stored?

I want to use a custom menu from the wordpress database but I get the elements disordered and I want them to have the same order how can i do that? There is a place in the database where the order is stored?

Share Improve this question asked Jul 30, 2014 at 11:41 Raúl Álvarez HinojosaRaúl Álvarez Hinojosa 31 silver badge2 bronze badges 2
  • I haven't confirmed this, but I would assume that since nav menus use the {prefix}_posts table, they would also use the menu_order column. – karpstrucking Commented Jul 30, 2014 at 11:58
  • possible duplicate of How is custom menu hierarchy output handled? – Max Yudin Commented Jul 30, 2014 at 12:10
Add a comment  | 

2 Answers 2

Reset to default 3

You will get the nav_menu_items from wp_term_relationship in correct order. if you want to confirm there order by knowing there order number... u will get the object id of each item from the previous table and search for that id in wp_posts. then there will be column for that particular row named menu_order. so that u can get the actual order number.

old post but a weird answer, maybe this is more current: fields for a post are either in the wp_posts table or the wp_postmeta, the one for menu_order is in wp_posts.

You can use the menu_order sorting for products in a shortcode like this:

[products order_by="menu_order" order="DESC" limit="-1" per_page="24" paginate="true"]

In my case, I imported products and their import order wasn't the same as the original date created. So by populating menu_order and using that shortcode I'm able to show a list new product releases in the correct order.

本文标签: Where is the order of a menu saved in the database