wp-admin/includes/ajax-actions.php:2709Handles image editing via AJAX.
function wp_ajax_image_editor() { $attachment_id = (int) $_POST['postid']; if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_die( -1 ); } check_ajax_referer( "image_editor-$attachment_id" ); require_once ABSPATH . 'wp-admin/includes/image-edit.php'; $message = false; switch ( $_POST['do'] ) { case 'save': $message = wp_save_image( $attachment_id ); if ( ! empty( $message->error ) ) { wp_send_json_error( $message ); } wp_send_json_success( $message ); break; case 'scale': $message = wp_save_image( $attachment_id ); break; case 'restore': $message = wp_restore_image( $attachment_id ); break; } ob_start(); wp_image_editor( $attachment_id, $message ); $html = ob_get_clean(); if ( ! empty( $message->error ) ) { wp_send_json_error( array( 'message' => $message, 'html' => $html, ) ); } wp_send_json_success( array( 'message' => $message, 'html' => $html, ) );}Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-admin/includes/ajax-actions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.