用于从全屏编辑器保存帖子的Ajax处理程序。

原型

wp_ajax_wp_fullscreen_save_post()

源文件

路径:wp-admin/includes/ajax-actions.php

<?php
...
function wp_ajax_wp_fullscreen_save_post() {
	$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
	$post = null;
	if ( $post_id )
		$post = get_post( $post_id );
	check_ajax_referer('update-post_' . $post_id, '_wpnonce');
	$post_id = edit_post();
	if ( is_wp_error( $post_id ) ) {
		wp_send_json_error();
	}
	if ( $post ) {
		$last_date = mysql2date( __( 'F j, Y' ), $post->post_modified );
		$last_time = mysql2date( __( 'g:i a' ), $post->post_modified );
	} else {
		$last_date = date_i18n( __( 'F j, Y' ) );
		$last_time = date_i18n( __( 'g:i a' ) );
	}
	if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) {
		$last_user = get_userdata( $last_id );
		$last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time );
	} else {
		$last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );
	}
	wp_send_json_success( array( 'last_edited' => $last_edited ) );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wp_ajax_wp_fullscreen_save_post/