wp-admin/menu.php


Lines:

1 to 100 of 364
<?php

/**
 * Build Administration Menu.
 *
 * @package WordPress
 * @subpackage Administration
 */


/**
 * Constructs the admin menu.
 *
 * The elements in the array are:
 *     0: Menu item name.
 *     1: Minimum level or capability required.
 *     2: The URL of the item's file.
 *     3: Page title.
 *     4: Classes.
 *     5: ID.
 *     6: Icon for top level menu.
 *
 * @global array $menu
 */

$menu[2] = array( __( 'Dashboard' ), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );

$submenu['index.php'][0] = array( __( 'Home' ), 'read', 'index.php' );

if ( is_multisite() ) {
  $submenu['index.php'][5] = array( __( 'My Sites' ), 'read', 'my-sites.php' );
}

if ( ! is_multisite() || current_user_can( 'update_core' ) ) {
  $update_data = wp_get_update_data();
}

if ( ! is_multisite() ) {
  if ( current_user_can( 'update_core' ) ) {
    $cap = 'update_core';
  } elseif ( current_user_can( 'update_plugins' ) ) {
    $cap = 'update_plugins';
  } elseif ( current_user_can( 'update_themes' ) ) {
    $cap = 'update_themes';
  } else {
    $cap = 'update_languages';
  }
  $submenu['index.php'][10] = array(
    sprintf(
      /* translators: %s: Number of pending updates. */
      __( 'Updates %s' ),
      sprintf(
        '<span class="update-plugins count-%s"><span class="update-count">%s</span></span>',
        $update_data['counts']['total'],
        number_format_i18n( $update_data['counts']['total'] )
      )
    ),
    $cap,
    'update-core.php',
  );
  unset( $cap );
}

$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );

// $menu[5] = Posts.

$menu[10]                     = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
  $submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' );
  /* translators: Add new file. */
  $submenu['upload.php'][10] = array( _x( 'Add New', 'file' ), 'upload_files', 'media-new.php' );
  $i                         = 15;
foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
  if ( ! $tax->show_ui || ! $tax->show_in_menu ) {
    continue;
  }

  $submenu['upload.php'][ $i++ ] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
}
  unset( $tax, $i );

$menu[15]                           = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
  $submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' );
  /* translators: Add new links. */
  $submenu['link-manager.php'][10] = array( _x( 'Add New', 'link' ), 'manage_links', 'link-add.php' );
  $submenu['link-manager.php'][15] = array( __( 'Link Categories' ), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );

// $menu[20] = Pages.

// Avoid the comment count query for users who cannot edit_posts.
if ( current_user_can( 'edit_posts' ) ) {
  $awaiting_mod      = wp_count_comments();
  $awaiting_mod      = $awaiting_mod->moderated;
  $awaiting_mod_i18n = number_format_i18n( $awaiting_mod );
  /* translators: %s: Number of comments. */
  $awaiting_mod_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), $awaiting_mod_i18n );

  $menu[25] = array(
    /* translators: %s: Number of comments. */
    sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count" aria-hidden="true">' . $awaiting_mod_i18n . '</span><span class="comments-in-moderation-text screen-reader-text">' . $awaiting_mod_text . '</span></span>' ),

 View on GitHub View on Trac

Called by

    Invoked by

      Call hooks

      API Letters: ,,,