update_recently_edited

The timeline below displays how wordpress function update_recently_edited has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Updates the "recently-edited" file for the plugin or theme file editor.
 *
 * @since 1.5.0
 *
 * @param string $file
 */
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);
}

WordPress Version: 5.9

/**
 * Update the "recently-edited" file for the plugin or theme file editor.
 *
 * @since 1.5.0
 *
 * @param string $file
 */
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);
}

WordPress Version: 4.4

/**
 * Update the "recently-edited" file for the plugin or theme editor.
 *
 * @since 1.5.0
 *
 * @param string $file
 */
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);
}

WordPress Version: 4.1

/**
 * {@internal Missing Short Description}}
 *
 * @since 1.5.0
 *
 * @param string $file
 */
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);
}

WordPress Version: 3.7

/**
 * {@internal Missing Short Description}}
 *
 * @since 1.5.0
 *
 * @param unknown_type $file
 */
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);
}