top of page

Modifying Admin Bar Menu in WordPress

  • Writer: سُلَيْمَان بْن دَاوُوْد
    سُلَيْمَان بْن دَاوُوْد
  • Jan 4, 2023
  • 1 min read

add_action( 'admin_bar_menu', 'add_links_to_admin_bar',999);

function add_links_to_admin_bar($admin_bar) {         
          $args = array(
                'parent' => 'site-name',
                'id'     => 'media-libray',
                'title'  => 'Media Library',
                'href'   => esc_url( admin_url( 'upload.php' ) ),
                'meta'   => false
       		);
       	$admin_bar->add_node( $args );
       
        	$args = array(
        		'parent' => 'site-name',
        		'id'     => 'plugins',
        		'title'  => 'Plugins',
        		'href'   => esc_url( admin_url( 'plugins.php' ) ),
        		'meta'   => false
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'homes',
        		'title'  => 'Homes',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=homes' ) ),
        		'meta'   => array('tabindex'=>10)
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'avlhomes',
        		'title'  => 'Avalaible Homes',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=available-homes' ) ),
        		'meta'   => array('tabindex'=>12)
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'custhomes',
        		'title'  => 'Custom Homes',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=custom-homes' ) ),
        		'meta'   => array('tabindex'=>12)
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'community',
        		'title'  => 'Community',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=community' ) ),
        		'meta'   => array('tabindex'=>12)
        	);
        $admin_bar->add_node( $args );
}



 
 
 

Recent Posts

See All
Duplicate Category in Wordpress

The following code helps to duplicate the default wordpress category by help of code. // Add Duplicate option for categories in WordPress...

 
 
 
C#.NET and Its Associated Codes

1- Creating an Desktop Application in C#.NET C# ADO.NET & MySQL MAIN C# and MySQL ADO.NET with Crystals Reports Ready Code 2- Handling...

 
 
 

Comments


© 2020 by syednazrulhassan

bottom of page