WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know how I can add (custom) modules to Appearance -> Menus? (Or has a link with explanation on how to do this) so that when people change their menu in the backend they can choose what to add to their menu (Pages - Post - Links - Categories - Tags - [custom module])

I ask this question because I want to build a one-page theme. I want to be able to add <section>s to the templates to separate the different 'pages'.
The (rough) idea I have, is create a function which 'scans' trough the templates, isolates the section ID's of these sections, and add them as a menu module to the backend. That way people would be able to add a menu item to one of these sections to their menus.

share|improve this question
Why don’t you just register a post type for the sections with show_in_nav_menus = TRUE? – toscho Jun 1 '14 at 12:28
That's it! Thanks! – Toine Jun 2 '14 at 6:59

When you register a custom post type, set the argument show_in_nav_menus to TRUE, and WordPress will create the box for you automatically. This works for custom taxonomies too.

Example, requires PHP 5.4 or newer.

add_action( 'wp_loaded', function() {

    $post_type = 'foo';

    add_action( 'registered_post_type', function( $registered ) use ( $post_type ) {

        if ( $registered !== $post_type )

                'label'             => 'Bars',
                'public'            => TRUE,
                'show_in_nav_menus' => TRUE

            'label'             => 'Foo',
            'public'            => TRUE,
            'show_in_nav_menus' => TRUE

Adding a custom box for anything else is more difficult. Well, adding it is easy, it is just a metabox with the parameter $screen set to nav-menus:

add_action( 'admin_init', function() {

        'Custom Box',
        function() {
            print 'Insert content here.';

The difficult part are the following actions: creating the proper HTML for the list items, saving those items with AJAX requests and rendering them in a nav menu on front-end. Inspect the built-in boxes for the details. Repeating and explaining that would require a novel.

The out put of both code examples should look like this:

enter image description here

You can see the boxes for the post type Foo, the taxonomy Bars and the Custom Box. Form is one of my own post types on that installation, Location on of my taxonomies, and Languages a custom box for all available languages in a multilingual network built with Multilingual Press.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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