wp_ajax_wp_fullscreen_save_post

Ajax handler for saving posts from the fullscreen editor.

Description

wp_ajax_wp_fullscreen_save_post(); 

Usage

  1. if ( !function_exists( 'wp_ajax_wp_fullscreen_save_post' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/ajax-actions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_ajax_wp_fullscreen_save_post(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/ajax-actions.php  
  1. function wp_ajax_wp_fullscreen_save_post() { 
  2. $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; 
  3.  
  4. $post = null; 
  5.  
  6. if ( $post_id ) 
  7. $post = get_post( $post_id ); 
  8.  
  9. check_ajax_referer('update-post_' . $post_id, '_wpnonce'); 
  10.  
  11. $post_id = edit_post(); 
  12.  
  13. if ( is_wp_error( $post_id ) ) { 
  14.  
  15. if ( $post ) { 
  16. $last_date = mysql2date( __( 'F j, Y' ), $post->post_modified ); 
  17. $last_time = mysql2date( __( 'g:i a' ), $post->post_modified ); 
  18. } else { 
  19. $last_date = date_i18n( __( 'F j, Y' ) ); 
  20. $last_time = date_i18n( __( 'g:i a' ) ); 
  21.  
  22. if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) { 
  23. $last_user = get_userdata( $last_id ); 
  24. $last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time ); 
  25. } else { 
  26. $last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time ); 
  27.  
  28. wp_send_json_success( array( 'last_edited' => $last_edited ) );