wp_admin_bar_dashboard_view_site_menu() - WordPress 函数参考中文文档

返回介绍

wp_admin_bar_dashboard_view_site_menu()

发布于 2017-09-11 字数 2124 浏览 772 评论 0

Warning: This function has been deprecated.

wp_admin_bar_dashboard_view_site_menu( WP_Admin_Bar $wp_admin_bar )

Add the “Dashboard”/”Visit Site” menu.


描述


参数

$wp_admin_bar

(WP_Admin_Bar)
(Required)
WP_Admin_Bar instance.


源代码

File: wp-includes/deprecated.php

function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
	_deprecated_function( __FUNCTION__, '3.3.0' );

	$user_id = get_current_user_id();

	if ( 0 != $user_id ) {
		if ( is_admin() )
			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
		elseif ( is_multisite() )
			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
		else
			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
	}
}

更新日志

Version 描述
3.3.0 This function has been deprecated.
3.2.0 Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    __()
  • wp-includes/load.php:
    is_admin()
  • wp-includes/load.php:
    is_multisite()
  • wp-includes/functions.php:
    _deprecated_function()
  • wp-includes/link-template.php:
    get_dashboard_url()
  • wp-includes/link-template.php:
    admin_url()
  • wp-includes/link-template.php:
    home_url()
  • wp-includes/class-wp-admin-bar.php:
    WP_Admin_Bar::add_menu()
  • wp-includes/user.php:
    get_current_user_id()
  • Show 4 more uses
    Hide more uses


User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!