• Iam using WordPress for my blog website,

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    function parent_menu_item()
        {
            global $wp_admin_bar;
    
            // Parent
            $wp_admin_bar->add_menu(
                array(
                     'id'       => 'parent_id_name'
                    ,'title'    => __( 'Parent Title', 'your_textdomain' )
                    ,'href'     => '#'
                )
            );
                // Link to dev mode admin page
                $wp_admin_bar->add_menu(
                    array(
                         'parent'   => 'parent_id_name'
                        ,'id'           => 'child_id_name'
                        ,'title'    => __( 'Child title', 'your_textdomain' )
                        ,'href'     => '#'
                    )
                );
        }
        add_action( 'add_admin_bar_menus', 'parent_menu_item', 10 );

    Above is correct way to add admin bar ?

    Thanks, Advance

    [ Signature moderated. ]

  • The topic ‘Adding menu to admin menu bar’ is closed to new replies.