wp_can_install_language_pack() - WordPress 函数参考中文文档

返回介绍

wp_can_install_language_pack()

发布于 2017-09-11 字数1337 浏览 946 评论 0

wp_can_install_language_pack()

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


描述


返回值

(bool) Returns true on success, false on failure.


源代码

File: wp-admin/includes/translation-install.php

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;
}

更新日志

Version 描述
4.0.0 Introduced.

相关函数

Uses

  • wp-includes/load.php:
    wp_is_file_mod_allowed()
  • wp-includes/load.php:
    is_wp_error()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!