
如何设置Nginx和Apach反向代理
get_site_url ( $blog_id = null, $path = '', $scheme = null )
get_site_url: 这个函数检索一个特定网站的URL。它接受一个参数:网站的ID。它以字符串形式返回网站的URL。
检索指定网站的URL,其中WordPress应用文件(例如wp-blog-header.php或wp-admin/文件夹)可以访问。
返回带有适当协议的’site_url’选项,如果is_ssl()则为’https’,否则为’http’。如果`$scheme`是’http’或’https’,`is_ssl()`将被覆盖。
function get_site_url( $blog_id = null, $path = '', $scheme = null ) { if ( empty( $blog_id ) || ! is_multisite() ) { $url = get_option( 'siteurl' ); } else { switch_to_blog( $blog_id ); $url = get_option( 'siteurl' ); restore_current_blog(); } $url = set_url_scheme( $url, $scheme ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } /** * Filters the site URL. * * @since 2.7.0 * * @param string $url The complete site URL including scheme and path. * @param string $path Path relative to the site URL. Blank string if no path is specified. * @param string|null $scheme Scheme to give the site URL context. Accepts 'http', 'https', 'login', * 'login_post', 'admin', 'relative' or null. * @param int|null $blog_id Site ID, or null for the current site. */ return apply_filters( 'site_url', $url, $path, $scheme, $blog_id ); }