Title: Admin Sub-menu order
Last modified: June 23, 2017

---

# Admin Sub-menu order

 *  Resolved [donalokeefe](https://wordpress.org/support/users/donalokeefe/)
 * (@donalokeefe)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/)
 * Hi,
 * I’m using the CPT UI plugin – which is awesome 🙂
 * – I’m currently adding custom post types to the admin menu as submenu items.
   
   i.e. I have a menu item called “Sales” and I add a Custom post type “Forms” to
   this . – I’m adding around 10 submenu items (all custom post types.) – I add 
   them to the main menu item “Sales” by adding “sales” into the “Show in Menu” 
   text field and setting this to true for each CPT – This is all working – However
   the order is always that in which I created the CPT’s – Changing the “Menu Position”
   value (item above in CPT UI) does nothing (I’m guessing because I am adding these
   as submenu items rather than to the root level?)
 * Is there any way to rearrange the sub-menu order?
 * Thanks for your help!!!
 * Donal

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/#post-9254210)
 * It very likely is a case of the menu position working only for the top level 
   items, and thus the rest being dependent on the order in which they’re registered/
   saved to the option we use. That said, I don’t have any sort of readymade solution
   here other than manually re-arranging the value saved in our option to match 
   the order you want, or deleting/recreating in that order. Either one is going
   to be a manual process and need some knowhow to properly handle without lost 
   data.
 *  Thread Starter [donalokeefe](https://wordpress.org/support/users/donalokeefe/)
 * (@donalokeefe)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/#post-9254230)
 * Thanks Michael,
 * I’m happy doing the coding and can update the functions file if that is the best
   path forward.
 * Any clue or reference to re-ordering sub-items would be great though. I just 
   have’t managed to find any code references to the order of sub menu items. There
   are lots for the main menu etc. And the coding references I have found that refer
   to sub-menus all revolve around creating them in php and then adding them (which
   gets around the order issue).
 * I already have a lot of content in the CPT’s so really hoping I don’t need to
   redo them in the right order. Also there is always a chance I’ll need to add 
   another one at a later date which would raise the issue again.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/#post-9254303)
 * Best ideas I had were to grab the JSON that we generate in the Tools menu, and
   re-order them with that information. This is outside of using the “get code” 
   functionality that we provide that generates some code for you to use in functions.
   php or so. Just using that would be another way, where you just copy/paste that
   in the order you want them registered.
 * Note that CPTUI does not delete post type/taxonomy content. The closest we come
   is changing the post type slug for the posts, or changing the associated taxonomy.
   Both of those need user approval. All in all, your content should be safe.
 * For example, I have this saved data in my local install: [https://gist.githubusercontent.com/tw2113/c7e7e165cd4858727262909156f5f1be/raw/65670feca56ae223bd39081dbd59732b01fa9353/gistfile1.txt](https://gist.githubusercontent.com/tw2113/c7e7e165cd4858727262909156f5f1be/raw/65670feca56ae223bd39081dbd59732b01fa9353/gistfile1.txt)
 * However, it’s hard to read, and hard to mentally grep. So, I end up running it
   through [https://jsonlint.com/](https://jsonlint.com/) to technically validate,
   but also “beautify” it. That gives me [https://gist.githubusercontent.com/tw2113/f22286ed6b4941fdbc02276a091ad7c5/raw/7ab4e6b38faa7f2f6412c936a0270ec1de25e4a9/gistfile1.txt](https://gist.githubusercontent.com/tw2113/f22286ed6b4941fdbc02276a091ad7c5/raw/7ab4e6b38faa7f2f6412c936a0270ec1de25e4a9/gistfile1.txt)
 * In that 2nd link, it’s easier to read and understand and you can see that I have
   2 post types. “sessions” and “films”. With that in mind, I can literally switch
   them around, and order them in whatever order I want, like so: [https://gist.githubusercontent.com/tw2113/bfd87592ee5aafd5c65019ba91def381/raw/f4476761a4e9a087dc303805ce747ae4b07459ab/gistfile1.txt](https://gist.githubusercontent.com/tw2113/bfd87592ee5aafd5c65019ba91def381/raw/f4476761a4e9a087dc303805ce747ae4b07459ab/gistfile1.txt)
 * Since the import side of the tools menu area takes valid JSON, I can copy that
   newly ordered version, as is, into that textarea and click import. That will 
   save the exact same post types and settings for it all, without data loss, and
   it would be in the new order desired.
 * This won’t be all that efficient in the long run, especially if you’re consistently
   juggling them around, but it would technically work.
 *  Thread Starter [donalokeefe](https://wordpress.org/support/users/donalokeefe/)
 * (@donalokeefe)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/#post-9254331)
 * Thanks Micheal,
 * I think this solves my problem!
 * Really appreciate the detailed response and help. Awesome support!!!!
 * Cheers
    Donal
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/#post-9254373)
 * Glad I could help 🙂
 * Would appreciate a review of the plugin, it helps keep us towards the top of 
   the results.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Admin Sub-menu order’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [menu](https://wordpress.org/support/topic-tag/menu/)
 * [order](https://wordpress.org/support/topic-tag/order/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [ui](https://wordpress.org/support/topic-tag/ui/)

 * 5 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/admin-sub-menu-order/#post-9254373)
 * Status: resolved