allow_subdirectory_install

函数
allow_subdirectory_install ( No parameters )
返回值
  • (bool) Whether subdirectory installation is allowed
定义位置
相关方法
allow_subdomain_installwp_plugin_directory_constantsis_subdomain_installget_subdirectory_reserved_nameswp_is_theme_directory_ignored
引入
3.0.0
弃用
-

allow_subdirectory_install: 这是一个过滤钩,允许你启用或禁用在子目录中安装WordPress的权限。

允许子目录的安装。

function allow_subdirectory_install() {
	global $wpdb;

	/**
	 * Filters whether to enable the subdirectory installation feature in Multisite.
	 *
	 * @since 3.0.0
	 *
	 * @param bool $allow Whether to enable the subdirectory installation feature in Multisite.
	 *                    Default false.
	 */
	if ( apply_filters( 'allow_subdirectory_install', false ) ) {
		return true;
	}

	if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) {
		return true;
	}

	$post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
	if ( empty( $post ) ) {
		return true;
	}

	return false;
}

常见问题

FAQs
查看更多 >