wp_ajax_edit_theme_plugin_file

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

WordPress Version: 6.3

/**
 * Handles editing a theme or plugin file via AJAX.
 *
 * @since 4.9.0
 *
 * @see wp_edit_theme_plugin_file()
 */
function wp_ajax_edit_theme_plugin_file()
{
    $r = wp_edit_theme_plugin_file(wp_unslash($_POST));
    // Validation of args is done in wp_edit_theme_plugin_file().
    if (is_wp_error($r)) {
        wp_send_json_error(array_merge(array('code' => $r->get_error_code(), 'message' => $r->get_error_message()), (array) $r->get_error_data()));
    } else {
        wp_send_json_success(array('message' => __('File edited successfully.')));
    }
}

WordPress Version: 5.5

/**
 * Ajax handler for editing a theme or plugin file.
 *
 * @since 4.9.0
 *
 * @see wp_edit_theme_plugin_file()
 */
function wp_ajax_edit_theme_plugin_file()
{
    $r = wp_edit_theme_plugin_file(wp_unslash($_POST));
    // Validation of args is done in wp_edit_theme_plugin_file().
    if (is_wp_error($r)) {
        wp_send_json_error(array_merge(array('code' => $r->get_error_code(), 'message' => $r->get_error_message()), (array) $r->get_error_data()));
    } else {
        wp_send_json_success(array('message' => __('File edited successfully.')));
    }
}

WordPress Version: 4.9

/**
 * Ajax handler for editing a theme or plugin file.
 *
 * @since 4.9.0
 * @see wp_edit_theme_plugin_file()
 */
function wp_ajax_edit_theme_plugin_file()
{
    $r = wp_edit_theme_plugin_file(wp_unslash($_POST));
    // Validation of args is done in wp_edit_theme_plugin_file().
    if (is_wp_error($r)) {
        wp_send_json_error(array_merge(array('code' => $r->get_error_code(), 'message' => $r->get_error_message()), (array) $r->get_error_data()));
    } else {
        wp_send_json_success(array('message' => __('File edited successfully.')));
    }
}