Title: Called dashbooard menu function
Last modified: August 19, 2016

---

# Called dashbooard menu function

 *  Resolved [peterjharrison](https://wordpress.org/support/users/peterjharrison/)
 * (@peterjharrison)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/)
 * Hi,
 * Was woondering if anyone knows of a way I can call the [_wp_menu_output] function
   from the front end of my website.
 * It is currently located in [wp-admin/menu-header.php] file but I would like to
   call it from my template.
 * I think this is one for the more advnaced WordPress developers, but any help 
   would be cool.
 * Regards
    Pete

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

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1340786)
 * Have you tried including the file?..
 * You can’t call a function from a file that’s not been loaded, so try an include
   first, then see if your function call works..
 *  Thread Starter [peterjharrison](https://wordpress.org/support/users/peterjharrison/)
 * (@peterjharrison)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1340984)
 * Hi,
 * Thanks for your reply.
 * I don’t think including the file is going to work there seems to be far to many
   includes that I will need.
 * I’ve been looking further into the code and what I actually want to use is the
   $menu and $submenu arrays that are used to build the admin menu in te dashboard.
 * Do you know if there is a way of accessing these from within a plugin?
 * Regards
    Pete
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1340987)
 * `include( 'wp-admin/menu.php' );`
 * $menu and $submenu are defined there, include it and you’ll have access to the
   vars..
 * Also, if preferred, you hook an action onto..
 *     ```
       _admin_menu
       ```
   
 * ..instead of the include..
 * You you will likely need to globalise the $menu and $submenu vars when using 
   the action hook..
 *     ```
       add_action( '_admin_menu' , 'example' );
       function example() {
       global $menu, $submenu;
       ..
       ```
   
 * 😉
 *  Thread Starter [peterjharrison](https://wordpress.org/support/users/peterjharrison/)
 * (@peterjharrison)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1341004)
 * Hi,
 * Thanks for your reply.
 * When I try and include the menu.php file I get the following error:
 * Warning: Invalid argument supplied for foreach() in /mnt/local/home/pjharrison/
   peterjharrison.me/wp-admin/menu.php on line 38
 * I think it has something to do with the $wp_taxonomies array, any ideas?
 * Regards
    Pete
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1341007)
 * It’s because when you include the file, there’s no $wp_taxonomies var for it 
   to loop over… where as when the file is usually included that var is present…
 * What do you think you should do ? … it’s your code … i can’t tell you how to 
   write it .. 😉
 *  Thread Starter [peterjharrison](https://wordpress.org/support/users/peterjharrison/)
 * (@peterjharrison)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1341010)
 * Hi
 * Thanks for your help.
 * I guess I’ll have to try and find out what populates the $wp_taxonomies array
   and see if it will effect what im trying to do if I push it through as blank.
 * Regards
    Pete

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

The topic ‘Called dashbooard menu function’ is closed to new replies.

## Tags

 * [functions](https://wordpress.org/support/topic-tag/functions/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [peterjharrison](https://wordpress.org/support/users/peterjharrison/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/called-dashbooard-menu-function/#post-1341010)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
