update_recently_edited

Update the "recently-edited" file for the plugin or theme editor.

Description

update_recently_edited( (string) $file ); 

Parameters (1)

0. $file (string)
The file.

Usage

  1. if ( !function_exists( 'update_recently_edited' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/misc.php'; 
  3.  
  4. // The file. 
  5. $file = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = update_recently_edited($file); 
  9.  

Defined (1)

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

/wp-admin/includes/misc.php  
  1. function update_recently_edited( $file ) { 
  2. $oldfiles = (array ) get_option( 'recently_edited' ); 
  3. if ( $oldfiles ) { 
  4. $oldfiles = array_reverse( $oldfiles ); 
  5. $oldfiles[] = $file; 
  6. $oldfiles = array_reverse( $oldfiles ); 
  7. $oldfiles = array_unique( $oldfiles ); 
  8. if ( 5 < count( $oldfiles )) 
  9. array_pop( $oldfiles ); 
  10. } else { 
  11. $oldfiles[] = $file; 
  12. update_option( 'recently_edited', $oldfiles );