wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_can_install_language_pack › WordPress Function

Since4.0.0
已弃用n/a
wp_can_install_language_pack ( 没有参数 )
返回:
  • (bool) Returns true on success, false on failure.
定义在:
文档:

Check if WordPress has access to the filesystem without asking for credentials.



源码

function wp_can_install_language_pack() {
	if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) {
		return false;
	}

	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
	$skin     = new Automatic_Upgrader_Skin();
	$upgrader = new Language_Pack_Upgrader( $skin );
	$upgrader->init();

	$check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );

	if ( ! $check || is_wp_error( $check ) ) {
		return false;
	}

	return true;
}