WordPress.org

Ready to get started?Download WordPress

Forums

Adding menu to admin menu bar (1 post)

  1. Deepansrec
    Member
    Posted 1 year ago #

    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. ]

Topic Closed

This topic has been closed to new replies.

About this Topic