wp/wp-includes/admin-bar.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     6  * @subpackage Toolbar
     6  * @subpackage Toolbar
     7  * @since 3.1.0
     7  * @since 3.1.0
     8  */
     8  */
     9 
     9 
    10 /**
    10 /**
    11  * Instantiate the admin bar object and set it up as a global for access elsewhere.
    11  * Instantiates the admin bar object and set it up as a global for access elsewhere.
    12  *
    12  *
    13  * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
    13  * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
    14  * For that, use show_admin_bar(false) or the {@see 'show_admin_bar'} filter.
    14  * For that, use show_admin_bar(false) or the {@see 'show_admin_bar'} filter.
    15  *
    15  *
    16  * @since 3.1.0
    16  * @since 3.1.0
    82 	if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) {
    82 	if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) {
    83 		return;
    83 		return;
    84 	}
    84 	}
    85 
    85 
    86 	/**
    86 	/**
    87 	 * Load all necessary admin bar items.
    87 	 * Loads all necessary admin bar items.
    88 	 *
    88 	 *
    89 	 * This is the hook used to add, remove, or manipulate admin bar items.
    89 	 * This is the hook used to add, remove, or manipulate admin bar items.
    90 	 *
    90 	 *
    91 	 * @since 3.1.0
    91 	 * @since 3.1.0
    92 	 *
    92 	 *
    93 	 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
    93 	 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance, passed by reference.
    94 	 */
    94 	 */
    95 	do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );
    95 	do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );
    96 
    96 
    97 	/**
    97 	/**
    98 	 * Fires before the admin bar is rendered.
    98 	 * Fires before the admin bar is rendered.
   112 
   112 
   113 	$rendered = true;
   113 	$rendered = true;
   114 }
   114 }
   115 
   115 
   116 /**
   116 /**
   117  * Add the WordPress logo menu.
   117  * Adds the WordPress logo menu.
   118  *
   118  *
   119  * @since 3.3.0
   119  * @since 3.3.0
   120  *
   120  *
   121  * @param WP_Admin_Bar $wp_admin_bar
   121  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   122  */
   122  */
   123 function wp_admin_bar_wp_menu( $wp_admin_bar ) {
   123 function wp_admin_bar_wp_menu( $wp_admin_bar ) {
   124 	if ( current_user_can( 'read' ) ) {
   124 	if ( current_user_can( 'read' ) ) {
   125 		$about_url = self_admin_url( 'about.php' );
   125 		$about_url = self_admin_url( 'about.php' );
   126 	} elseif ( is_multisite() ) {
   126 	} elseif ( is_multisite() ) {
   196 		)
   196 		)
   197 	);
   197 	);
   198 }
   198 }
   199 
   199 
   200 /**
   200 /**
   201  * Add the sidebar toggle button.
   201  * Adds the sidebar toggle button.
   202  *
   202  *
   203  * @since 3.8.0
   203  * @since 3.8.0
   204  *
   204  *
   205  * @param WP_Admin_Bar $wp_admin_bar
   205  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   206  */
   206  */
   207 function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
   207 function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
   208 	if ( is_admin() ) {
   208 	if ( is_admin() ) {
   209 		$wp_admin_bar->add_node(
   209 		$wp_admin_bar->add_node(
   210 			array(
   210 			array(
   215 		);
   215 		);
   216 	}
   216 	}
   217 }
   217 }
   218 
   218 
   219 /**
   219 /**
   220  * Add the "My Account" item.
   220  * Adds the "My Account" item.
   221  *
   221  *
   222  * @since 3.3.0
   222  * @since 3.3.0
   223  *
   223  *
   224  * @param WP_Admin_Bar $wp_admin_bar
   224  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   225  */
   225  */
   226 function wp_admin_bar_my_account_item( $wp_admin_bar ) {
   226 function wp_admin_bar_my_account_item( $wp_admin_bar ) {
   227 	$user_id      = get_current_user_id();
   227 	$user_id      = get_current_user_id();
   228 	$current_user = wp_get_current_user();
   228 	$current_user = wp_get_current_user();
   229 
   229 
   256 		)
   256 		)
   257 	);
   257 	);
   258 }
   258 }
   259 
   259 
   260 /**
   260 /**
   261  * Add the "My Account" submenu items.
   261  * Adds the "My Account" submenu items.
   262  *
   262  *
   263  * @since 3.1.0
   263  * @since 3.1.0
   264  *
   264  *
   265  * @param WP_Admin_Bar $wp_admin_bar
   265  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   266  */
   266  */
   267 function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
   267 function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
   268 	$user_id      = get_current_user_id();
   268 	$user_id      = get_current_user_id();
   269 	$current_user = wp_get_current_user();
   269 	$current_user = wp_get_current_user();
   270 
   270 
   326 		)
   326 		)
   327 	);
   327 	);
   328 }
   328 }
   329 
   329 
   330 /**
   330 /**
   331  * Add the "Site Name" menu.
   331  * Adds the "Site Name" menu.
   332  *
   332  *
   333  * @since 3.3.0
   333  * @since 3.3.0
   334  *
   334  *
   335  * @param WP_Admin_Bar $wp_admin_bar
   335  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   336  */
   336  */
   337 function wp_admin_bar_site_menu( $wp_admin_bar ) {
   337 function wp_admin_bar_site_menu( $wp_admin_bar ) {
   338 	// Don't show for logged out users.
   338 	// Don't show for logged out users.
   339 	if ( ! is_user_logged_in() ) {
   339 	if ( ! is_user_logged_in() ) {
   340 		return;
   340 		return;
   407 		wp_admin_bar_appearance_menu( $wp_admin_bar );
   407 		wp_admin_bar_appearance_menu( $wp_admin_bar );
   408 	}
   408 	}
   409 }
   409 }
   410 
   410 
   411 /**
   411 /**
       
   412  * Adds the "Edit site" link to the Toolbar.
       
   413  *
       
   414  * @since 5.9.0
       
   415  *
       
   416  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
       
   417  */
       
   418 function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
       
   419 	// Don't show if a block theme is not activated.
       
   420 	if ( ! wp_is_block_theme() ) {
       
   421 		return;
       
   422 	}
       
   423 
       
   424 	// Don't show for users who can't edit theme options or when in the admin.
       
   425 	if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
       
   426 		return;
       
   427 	}
       
   428 
       
   429 	$wp_admin_bar->add_node(
       
   430 		array(
       
   431 			'id'    => 'site-editor',
       
   432 			'title' => __( 'Edit site' ),
       
   433 			'href'  => admin_url( 'site-editor.php' ),
       
   434 		)
       
   435 	);
       
   436 }
       
   437 
       
   438 /**
   412  * Adds the "Customize" link to the Toolbar.
   439  * Adds the "Customize" link to the Toolbar.
   413  *
   440  *
   414  * @since 4.3.0
   441  * @since 4.3.0
   415  *
   442  *
   416  * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
   443  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   417  * @global WP_Customize_Manager $wp_customize
   444  * @global WP_Customize_Manager $wp_customize
   418  */
   445  */
   419 function wp_admin_bar_customize_menu( $wp_admin_bar ) {
   446 function wp_admin_bar_customize_menu( $wp_admin_bar ) {
   420 	global $wp_customize;
   447 	global $wp_customize;
       
   448 
       
   449 	// Don't show if a block theme is activated and no plugins use the customizer.
       
   450 	if ( wp_is_block_theme() && ! has_action( 'customize_register' ) ) {
       
   451 		return;
       
   452 	}
   421 
   453 
   422 	// Don't show for users who can't access the customizer or when in the admin.
   454 	// Don't show for users who can't access the customizer or when in the admin.
   423 	if ( ! current_user_can( 'customize' ) || is_admin() ) {
   455 	if ( ! current_user_can( 'customize' ) || is_admin() ) {
   424 		return;
   456 		return;
   425 	}
   457 	}
   453 	);
   485 	);
   454 	add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
   486 	add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
   455 }
   487 }
   456 
   488 
   457 /**
   489 /**
   458  * Add the "My Sites/[Site Name]" menu and all submenus.
   490  * Adds the "My Sites/[Site Name]" menu and all submenus.
   459  *
   491  *
   460  * @since 3.1.0
   492  * @since 3.1.0
   461  *
   493  *
   462  * @param WP_Admin_Bar $wp_admin_bar
   494  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   463  */
   495  */
   464 function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
   496 function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
   465 	// Don't show for logged out users or single site mode.
   497 	// Don't show for logged out users or single site mode.
   466 	if ( ! is_user_logged_in() || ! is_multisite() ) {
   498 	if ( ! is_user_logged_in() || ! is_multisite() ) {
   467 		return;
   499 		return;
   577 				'class' => current_user_can( 'manage_network' ) ? 'ab-sub-secondary' : '',
   609 				'class' => current_user_can( 'manage_network' ) ? 'ab-sub-secondary' : '',
   578 			),
   610 			),
   579 		)
   611 		)
   580 	);
   612 	);
   581 
   613 
       
   614 	/**
       
   615 	 * Filters whether to show the site icons in toolbar.
       
   616 	 *
       
   617 	 * Returning false to this hook is the recommended way to hide site icons in the toolbar.
       
   618 	 * A truthy return may have negative performance impact on large multisites.
       
   619 	 *
       
   620 	 * @since 6.0.0
       
   621 	 *
       
   622 	 * @param bool $show_site_icons Whether site icons should be shown in the toolbar. Default true.
       
   623 	 */
       
   624 	$show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true );
       
   625 
   582 	foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
   626 	foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
   583 		switch_to_blog( $blog->userblog_id );
   627 		switch_to_blog( $blog->userblog_id );
   584 
   628 
   585 		if ( has_site_icon() ) {
   629 		if ( true === $show_site_icons && has_site_icon() ) {
   586 			$blavatar = sprintf(
   630 			$blavatar = sprintf(
   587 				'<img class="blavatar" src="%s" srcset="%s 2x" alt="" width="16" height="16" />',
   631 				'<img class="blavatar" src="%s" srcset="%s 2x" alt="" width="16" height="16"%s />',
   588 				esc_url( get_site_icon_url( 16 ) ),
   632 				esc_url( get_site_icon_url( 16 ) ),
   589 				esc_url( get_site_icon_url( 32 ) )
   633 				esc_url( get_site_icon_url( 32 ) ),
       
   634 				( wp_lazy_loading_enabled( 'img', 'site_icon_in_toolbar' ) ? ' loading="lazy"' : '' )
   590 			);
   635 			);
   591 		} else {
   636 		} else {
   592 			$blavatar = '<div class="blavatar"></div>';
   637 			$blavatar = '<div class="blavatar"></div>';
   593 		}
   638 		}
   594 
   639 
   663 		restore_current_blog();
   708 		restore_current_blog();
   664 	}
   709 	}
   665 }
   710 }
   666 
   711 
   667 /**
   712 /**
   668  * Provide a shortlink.
   713  * Provides a shortlink.
   669  *
   714  *
   670  * @since 3.1.0
   715  * @since 3.1.0
   671  *
   716  *
   672  * @param WP_Admin_Bar $wp_admin_bar
   717  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   673  */
   718  */
   674 function wp_admin_bar_shortlink_menu( $wp_admin_bar ) {
   719 function wp_admin_bar_shortlink_menu( $wp_admin_bar ) {
   675 	$short = wp_get_shortlink( 0, 'query' );
   720 	$short = wp_get_shortlink( 0, 'query' );
   676 	$id    = 'get-shortlink';
   721 	$id    = 'get-shortlink';
   677 
   722 
   690 		)
   735 		)
   691 	);
   736 	);
   692 }
   737 }
   693 
   738 
   694 /**
   739 /**
   695  * Provide an edit link for posts and terms.
   740  * Provides an edit link for posts and terms.
   696  *
   741  *
   697  * @since 3.1.0
   742  * @since 3.1.0
   698  * @since 5.5.0 Added a "View Post" link on Comments screen for a single post.
   743  * @since 5.5.0 Added a "View Post" link on Comments screen for a single post.
   699  *
   744  *
   700  * @global WP_Term  $tag
   745  * @global WP_Term  $tag
   701  * @global WP_Query $wp_the_query WordPress Query object.
   746  * @global WP_Query $wp_the_query WordPress Query object.
   702  * @global int      $user_id      The ID of the user being edited. Not to be confused with the
   747  * @global int      $user_id      The ID of the user being edited. Not to be confused with the
   703  *                                global $user_ID, which contains the ID of the current user.
   748  *                                global $user_ID, which contains the ID of the current user.
   704  * @global int      $post_id      The ID of the post when editing comments for a single post.
   749  * @global int      $post_id      The ID of the post when editing comments for a single post.
   705  *
   750  *
   706  * @param WP_Admin_Bar $wp_admin_bar
   751  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   707  */
   752  */
   708 function wp_admin_bar_edit_menu( $wp_admin_bar ) {
   753 function wp_admin_bar_edit_menu( $wp_admin_bar ) {
   709 	global $tag, $wp_the_query, $user_id, $post_id;
   754 	global $tag, $wp_the_query, $user_id, $post_id;
   710 
   755 
   711 	if ( is_admin() ) {
   756 	if ( is_admin() ) {
   834 		}
   879 		}
   835 	}
   880 	}
   836 }
   881 }
   837 
   882 
   838 /**
   883 /**
   839  * Add "Add New" menu.
   884  * Adds "Add New" menu.
   840  *
   885  *
   841  * @since 3.1.0
   886  * @since 3.1.0
   842  *
   887  *
   843  * @param WP_Admin_Bar $wp_admin_bar
   888  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   844  */
   889  */
   845 function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
   890 function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
   846 	$actions = array();
   891 	$actions = array();
   847 
   892 
   848 	$cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
   893 	$cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
   910 		);
   955 		);
   911 	}
   956 	}
   912 }
   957 }
   913 
   958 
   914 /**
   959 /**
   915  * Add edit comments link with awaiting moderation count bubble.
   960  * Adds edit comments link with awaiting moderation count bubble.
   916  *
   961  *
   917  * @since 3.1.0
   962  * @since 3.1.0
   918  *
   963  *
   919  * @param WP_Admin_Bar $wp_admin_bar
   964  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   920  */
   965  */
   921 function wp_admin_bar_comments_menu( $wp_admin_bar ) {
   966 function wp_admin_bar_comments_menu( $wp_admin_bar ) {
   922 	if ( ! current_user_can( 'edit_posts' ) ) {
   967 	if ( ! current_user_can( 'edit_posts' ) ) {
   923 		return;
   968 		return;
   924 	}
   969 	}
   943 		)
   988 		)
   944 	);
   989 	);
   945 }
   990 }
   946 
   991 
   947 /**
   992 /**
   948  * Add appearance submenu items to the "Site Name" menu.
   993  * Adds appearance submenu items to the "Site Name" menu.
   949  *
   994  *
   950  * @since 3.1.0
   995  * @since 3.1.0
   951  *
   996  *
   952  * @param WP_Admin_Bar $wp_admin_bar
   997  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
   953  */
   998  */
   954 function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
   999 function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
   955 	$wp_admin_bar->add_group(
  1000 	$wp_admin_bar->add_group(
   956 		array(
  1001 		array(
   957 			'parent' => 'site-name',
  1002 			'parent' => 'site-name',
  1025 	}
  1070 	}
  1026 
  1071 
  1027 }
  1072 }
  1028 
  1073 
  1029 /**
  1074 /**
  1030  * Provide an update link if theme/plugin/core updates are available.
  1075  * Provides an update link if theme/plugin/core updates are available.
  1031  *
  1076  *
  1032  * @since 3.1.0
  1077  * @since 3.1.0
  1033  *
  1078  *
  1034  * @param WP_Admin_Bar $wp_admin_bar
  1079  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
  1035  */
  1080  */
  1036 function wp_admin_bar_updates_menu( $wp_admin_bar ) {
  1081 function wp_admin_bar_updates_menu( $wp_admin_bar ) {
  1037 
  1082 
  1038 	$update_data = wp_get_update_data();
  1083 	$update_data = wp_get_update_data();
  1039 
  1084 
  1059 		)
  1104 		)
  1060 	);
  1105 	);
  1061 }
  1106 }
  1062 
  1107 
  1063 /**
  1108 /**
  1064  * Add search form.
  1109  * Adds search form.
  1065  *
  1110  *
  1066  * @since 3.3.0
  1111  * @since 3.3.0
  1067  *
  1112  *
  1068  * @param WP_Admin_Bar $wp_admin_bar
  1113  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
  1069  */
  1114  */
  1070 function wp_admin_bar_search_menu( $wp_admin_bar ) {
  1115 function wp_admin_bar_search_menu( $wp_admin_bar ) {
  1071 	if ( is_admin() ) {
  1116 	if ( is_admin() ) {
  1072 		return;
  1117 		return;
  1073 	}
  1118 	}
  1090 		)
  1135 		)
  1091 	);
  1136 	);
  1092 }
  1137 }
  1093 
  1138 
  1094 /**
  1139 /**
  1095  * Add a link to exit recovery mode when Recovery Mode is active.
  1140  * Adds a link to exit recovery mode when Recovery Mode is active.
  1096  *
  1141  *
  1097  * @since 5.2.0
  1142  * @since 5.2.0
  1098  *
  1143  *
  1099  * @param WP_Admin_Bar $wp_admin_bar
  1144  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
  1100  */
  1145  */
  1101 function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) {
  1146 function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) {
  1102 	if ( ! wp_is_recovery_mode() ) {
  1147 	if ( ! wp_is_recovery_mode() ) {
  1103 		return;
  1148 		return;
  1104 	}
  1149 	}
  1116 		)
  1161 		)
  1117 	);
  1162 	);
  1118 }
  1163 }
  1119 
  1164 
  1120 /**
  1165 /**
  1121  * Add secondary menus.
  1166  * Adds secondary menus.
  1122  *
  1167  *
  1123  * @since 3.3.0
  1168  * @since 3.3.0
  1124  *
  1169  *
  1125  * @param WP_Admin_Bar $wp_admin_bar
  1170  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
  1126  */
  1171  */
  1127 function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) {
  1172 function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) {
  1128 	$wp_admin_bar->add_group(
  1173 	$wp_admin_bar->add_group(
  1129 		array(
  1174 		array(
  1130 			'id'   => 'top-secondary',
  1175 			'id'   => 'top-secondary',
  1144 		)
  1189 		)
  1145 	);
  1190 	);
  1146 }
  1191 }
  1147 
  1192 
  1148 /**
  1193 /**
  1149  * Style and scripts for the admin bar.
  1194  * Prints style and scripts for the admin bar.
  1150  *
  1195  *
  1151  * @since 3.1.0
  1196  * @since 3.1.0
  1152  */
  1197  */
  1153 function wp_admin_bar_header() {
  1198 function wp_admin_bar_header() {
  1154 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
  1199 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
  1156 <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
  1201 <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
  1157 	<?php
  1202 	<?php
  1158 }
  1203 }
  1159 
  1204 
  1160 /**
  1205 /**
  1161  * Default admin bar callback.
  1206  * Prints default admin bar callback.
  1162  *
  1207  *
  1163  * @since 3.1.0
  1208  * @since 3.1.0
  1164  */
  1209  */
  1165 function _admin_bar_bump_cb() {
  1210 function _admin_bar_bump_cb() {
  1166 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
  1211 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
  1167 	?>
  1212 	?>
  1168 <style<?php echo $type_attr; ?> media="screen">
  1213 <style<?php echo $type_attr; ?> media="screen">
  1169 	html { margin-top: 32px !important; }
  1214 	html { margin-top: 32px !important; }
  1170 	* html body { margin-top: 32px !important; }
       
  1171 	@media screen and ( max-width: 782px ) {
  1215 	@media screen and ( max-width: 782px ) {
  1172 		html { margin-top: 46px !important; }
  1216 		html { margin-top: 46px !important; }
  1173 		* html body { margin-top: 46px !important; }
       
  1174 	}
  1217 	}
  1175 </style>
  1218 </style>
  1176 	<?php
  1219 	<?php
  1177 }
  1220 }
  1178 
  1221 
  1201  * Conditional Tags} article in the Theme Developer Handbook.
  1244  * Conditional Tags} article in the Theme Developer Handbook.
  1202  *
  1245  *
  1203  * @since 3.1.0
  1246  * @since 3.1.0
  1204  *
  1247  *
  1205  * @global bool   $show_admin_bar
  1248  * @global bool   $show_admin_bar
  1206  * @global string $pagenow
  1249  * @global string $pagenow        The filename of the current screen.
  1207  *
  1250  *
  1208  * @return bool Whether the admin bar should be showing.
  1251  * @return bool Whether the admin bar should be showing.
  1209  */
  1252  */
  1210 function is_admin_bar_showing() {
  1253 function is_admin_bar_showing() {
  1211 	global $show_admin_bar, $pagenow;
  1254 	global $show_admin_bar, $pagenow;
  1246 
  1289 
  1247 	return $show_admin_bar;
  1290 	return $show_admin_bar;
  1248 }
  1291 }
  1249 
  1292 
  1250 /**
  1293 /**
  1251  * Retrieve the admin bar display preference of a user.
  1294  * Retrieves the admin bar display preference of a user.
  1252  *
  1295  *
  1253  * @since 3.1.0
  1296  * @since 3.1.0
  1254  * @access private
  1297  * @access private
  1255  *
  1298  *
  1256  * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
  1299  * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'