返回介绍

create_empty_blog()

发布于 2017-09-10 21:57:56 字数 2561 浏览 1238 评论 0 收藏 0

Warning: This function has been deprecated.

create_empty_blog( string $domain,  string $path,  string $weblog_title,  int $site_id = 1 )

Create an empty blog.


description


参数

$domain

(string) (Required) The new blog's domain.

$path

(string) (Required) The new blog's path.

$weblog_title

(string) (Required) The new blog's title.

$site_id

(int) (Optional) Defaults to 1.

Default value: 1


返回值

(string|int) The ID of the newly created blog


源代码

File: wp-includes/ms-deprecated.php

function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
	_deprecated_function( __FUNCTION__, '4.4.0' );

	if ( empty($path) )
		$path = '/';

	// Check if the domain has been used already. We should return an error message.
	if ( domain_exists($domain, $path, $site_id) )
		return __( '<strong>ERROR</strong>: Site URL already taken.' );

	// Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
	// Need to get blog_id from wp_blogs, and create new table names.
	// Must restore table names at the end of function.

	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
		return __( '<strong>ERROR</strong>: problem creating site entry.' );

	switch_to_blog($blog_id);
	install_blog($blog_id);
	restore_current_blog();

	return $blog_id;
}

更新日志

Versiondescription
4.4.0This function has been deprecated.
MU 1.0Introduced.

相关函数

Uses

  • wp-includes/l10n.php: __()
  • wp-includes/functions.php: _deprecated_function()
  • wp-includes/ms-functions.php: domain_exists()
  • wp-includes/ms-functions.php: insert_blog()
  • wp-includes/ms-functions.php: install_blog()
  • wp-includes/ms-blogs.php: switch_to_blog()
  • wp-includes/ms-blogs.php: restore_current_blog()
  • Show 2 more uses Hide more uses

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文