^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_site()用法示例

get_site( WP_Site|int|null $site = null )

Retrieves site data given a site ID or site object.


描述

Site data will be cached and returned after being passed through a filter. If the provided site is empty, the current site global will be used.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包


参数

$site

(WP_Site|int|null)
(Optional)
Site to retrieve. Default is the current site.

Default value: null


返回值

(WP_Site|null) The site object or null if not found.


源代码

File: wp-includes/ms-blogs.php

function get_site( $site = null ) {
	if ( empty( $site ) ) {
		$site = get_current_blog_id();
	}

	if ( $site instanceof WP_Site ) {
		$_site = $site;
	} elseif ( is_object( $site ) ) {
		$_site = new WP_Site( $site );
	} else {
		$_site = WP_Site::get_instance( $site );
	}

	if ( ! $_site ) {
		return null;
	}

	/**
	 * Fires after a site is retrieved.
	 *
	 * @since 4.6.0
	 *
	 * @param WP_Site $_site Site data.
	 */
	$_site = apply_filters( 'get_site', $_site );

	return $_site;
}

更新日志

Version 描述
4.6.0 Introduced.

相关函数

Uses

  • wp-includes/ms-blogs.php:
    get_site
  • wp-includes/class-wp-site.php:
    WP_Site::__construct()
  • wp-includes/class-wp-site.php:
    WP_Site::get_instance()
  • wp-includes/load.php:
    get_current_blog_id()
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:
    WP_REST_Users_Controller::create_item()
  • wp-includes/class-wp-site-query.php:
    WP_Site_Query::get_sites()
  • wp-admin/includes/ms.php:
    wpmu_delete_blog()
  • wp-includes/user.php:
    is_user_member_of_blog()
  • wp-includes/ms-deprecated.php:
    wp_get_sites()
  • wp-includes/ms-functions.php:
    get_active_blog_for_user()
  • wp-includes/ms-functions.php:
    add_user_to_blog()
  • wp-includes/ms-load.php:
    ms_site_check()
  • wp-includes/ms-deprecated.php:
    get_dashboard_blog()
  • wp-includes/ms-blogs.php:
    get_blog_status()
  • wp-includes/ms-blogs.php:
    refresh_blog_details()
  • wp-includes/ms-blogs.php:
    update_blog_details()
  • wp-includes/ms-blogs.php:
    get_blogaddress_by_id()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::_multisite_getUsersBlogs()
  • Show 9 more used by
    Hide more used by


让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈