_upgrade_422_remove_genericons

Cleans up Genericons example files.

Description

_upgrade_422_remove_genericons(); 

Usage

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

Defined (1)

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

/wp-admin/includes/update-core.php  
  1. function _upgrade_422_remove_genericons() { 
  2. global $wp_theme_directories, $wp_filesystem; 
  3.  
  4. // A list of the affected files using the filesystem absolute paths. 
  5. $affected_files = array(); 
  6.  
  7. // Themes 
  8. foreach ( $wp_theme_directories as $directory ) { 
  9. $affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory ); 
  10. $affected_files = array_merge( $affected_files, $affected_theme_files ); 
  11.  
  12. // Plugins 
  13. $affected_files = array_merge( $affected_files, $affected_plugin_files ); 
  14.  
  15. foreach ( $affected_files as $file ) { 
  16. $gen_dir = $wp_filesystem->find_folder( trailingslashit( dirname( $file ) ) ); 
  17. if ( empty( $gen_dir ) ) { 
  18. continue; 
  19.  
  20. // The path when the file is accessed via WP_Filesystem may differ in the case of FTP 
  21. $remote_file = $gen_dir . basename( $file ); 
  22.  
  23. if ( ! $wp_filesystem->exists( $remote_file ) ) { 
  24. continue; 
  25.  
  26. if ( ! $wp_filesystem->delete( $remote_file, false, 'f' ) ) { 
  27. $wp_filesystem->put_contents( $remote_file, '' );