allow_subdomain_install

函式
allow_subdomain_install ( No parameters )
返回值
  • (bool) Whether subdomain installation is allowed
定義位置
相關方法
is_subdomain_installallow_subdirectory_installms_subdomain_constantsinstall_plugin_install_statusdomain_exists
引入
3.0.0
棄用
-

allow_subdomain_install: 這是一個過濾鉤子,允許你啟用或禁用在子域中安裝WordPress的許可權。

允許子域安裝

function allow_subdomain_install() {
	$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
	if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+.[0-9]+.[0-9]+.[0-9]+$|', $domain ) ) {
		return false;
	}

	return true;
}

常見問題

FAQs
檢視更多 >