wp_can_install_language_pack

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

Description

wp_can_install_language_pack(); 

Usage

  1. if ( !function_exists( 'wp_can_install_language_pack' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/translation-install.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_can_install_language_pack(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/translation-install.php  
  1. function wp_can_install_language_pack() { 
  2. if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { 
  3. return false; 
  4.  
  5. require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 
  6. $skin = new Automatic_Upgrader_Skin; 
  7. $upgrader = new Language_Pack_Upgrader( $skin ); 
  8. $upgrader->init(); 
  9.  
  10. $check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); 
  11.  
  12. if ( ! $check || is_wp_error( $check ) ) { 
  13. return false; 
  14.  
  15. return true;