wp_xmlrpc_server::_multisite_getUsersBlogs( array $args ): array|IXR_Error

In this article

Private function for retrieving a users blogs for multisite setups.

Parameters

$argsarrayrequired
Method arguments. Note: arguments must be ordered as documented.
  • int
    Blog ID (unused).
  • 1 string
    Username.
  • 2 string
    Password.

Return

array|IXR_Error

Source

protected function _multisite_getUsersBlogs( $args ) {
	$current_blog = get_site();

	$domain = $current_blog->domain;
	$path   = $current_blog->path . 'xmlrpc.php';

	$blogs = $this->wp_getUsersBlogs( $args );
	if ( $blogs instanceof IXR_Error ) {
		return $blogs;
	}

	if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
		return $blogs;
	} else {
		foreach ( (array) $blogs as $blog ) {
			if ( str_contains( $blog['url'], $_SERVER['HTTP_HOST'] ) ) {
				return array( $blog );
			}
		}
		return array();
	}
}

Changelog

VersionDescription
3.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.