update_recently_edited() WordPress Function

The update_recently_edited() function is used to update the list of recently edited pages. This function is generally called when a page is edited, but can also be called explicitly.

update_recently_edited( string $file ) #

Updates the “recently-edited” file for the plugin or theme file editor.


Parameters

$file

(string)(Required)


Top ↑

Source

File: wp-admin/includes/misc.php

338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
function update_recently_edited( $file ) {
    $oldfiles = (array) get_option( 'recently_edited' );
 
    if ( $oldfiles ) {
        $oldfiles   = array_reverse( $oldfiles );
        $oldfiles[] = $file;
        $oldfiles   = array_reverse( $oldfiles );
        $oldfiles   = array_unique( $oldfiles );
 
        if ( 5 < count( $oldfiles ) ) {
            array_pop( $oldfiles );
        }
    } else {
        $oldfiles[] = $file;
    }
 
    update_option( 'recently_edited', $oldfiles );
}


Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.