Display admin menu items in checkboxes
-
I’m working on an option page for my plugin and I’m trying to display all of the current admin menu items, including custom menus, in a list of checkboxes. So far, I’ve been able to use the following to get the list of the menu items:
global $menu; foreach ( $menu as $group => $items ) { foreach ( $items as $position => $item ) { // echo $item; printf( '<input type="checkbox" name="menu_option_name[menu_items]" id="menu_items" value="menu_items" %s> <label for="menu_items">' . $item . '</label>', ( isset( $this->menu_options['menu_items'] ) && $this->menu_options['menu_items'] === 'menu_items' ) ? 'checked' : '' ); echo '<br>'; } }
Which gives this output:
https://s32.postimg.org/3oej4pbdh/menu_array.pngHow can I have this list just the file name (ex: index.php)? I noticed that the menu’s file name is on the [2] position of each array.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display admin menu items in checkboxes’ is closed to new replies.