wppaste
WordPress

wp_ajax_wp_fullscreen_save_post()

Since
3.1.0
Source
wp-admin/includes/ajax-actions.php:2880
Handles saving posts from the fullscreen editor via AJAX.

Compatibility

Deprecated in WordPress 4.3.0. Kept for back-compatibility; avoid it in new code.

WordPress
since 3.1.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Performance profile

How much work a call to wp_ajax_wp_fullscreen_save_post() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reaches the database via get_post().

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
55–82

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 106.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • querycontent queryget_post()called directly
  • hookthird-party callbacksdo_action()one call below wp_ajax_wp_fullscreen_save_post()

Further down the call graph this can also reach option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 16 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_ajax_wp_fullscreen_save_post() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!is_wp_error()55–58check_ajax_referer(), edit_post(), is_wp_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), __(), sprintf(), last_edited()
is_wp_error()57–60check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), __(), sprintf(), last_edited()
!is_wp_error()59–62get_post(), check_ajax_referer(), edit_post(), is_wp_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), __(), sprintf(), last_edited()
is_wp_error()61–64get_post(), check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), __(), sprintf(), last_edited()
!is_wp_error()62–65check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited()
is_wp_error()64–67check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited()
!is_wp_error()66–69get_post(), check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited()
!is_wp_error()66–69check_ajax_referer(), edit_post(), is_wp_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
is_wp_error()68–71get_post(), check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited()
is_wp_error()68–71check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
!is_wp_error()70–73get_post(), check_ajax_referer(), edit_post(), is_wp_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
is_wp_error()72–75get_post(), check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
4 further outcomes, up to 82 instructions
!is_wp_error()73–76check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
is_wp_error()75–78check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
!is_wp_error()77–80get_post(), check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()
is_wp_error()79–82get_post(), check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev10655–825
8.510655–825
8.410655–825
8.310655–825
8.210655–825
8.110655–8251 fewer instruction than PHP 7.4
7.410755–835

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 12

  • get_post()Retrieves post data given a post ID or post object.
  • check_ajax_referer()Verifies the Ajax request to prevent processing requests external of the blog.
  • edit_post()Updates an existing post with values provided in `$_POST`.
  • is_wp_error()Checks whether the given variable is a WordPress Error.
  • wp_send_json_error()Sends a JSON response back to an Ajax request, indicating failure.
  • mysql2date()Converts given MySQL date string into a different format.
  • __()Retrieves the translation of $text.
  • date_i18n()Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds.
  • get_post_meta()Retrieves a post meta field for the given post ID.
  • get_userdata()Retrieves user info by user ID.
  • esc_html()Escaping for HTML blocks.
  • wp_send_json_success()Sends a JSON response back to an Ajax request, indicating success.

Source code

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' ) );	} 	$last_id = get_post_meta( $post_id, '_edit_last', true );	if ( $last_id ) {		$last_user = get_userdata( $last_id );		/* translators: 1: User's display name, 2: Date of last edit, 3: Time of last edit. */		$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 {		/* translators: 1: Date of last edit, 2: Time of last edit. */		$last_edited = sprintf( __( 'Last edited on %1$s at %2$s' ), $last_date, $last_time );	} 	wp_send_json_success( array( 'last_edited' => $last_edited ) );}

Changelog

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.3.0
Deprecated.from the docblock
3.1.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/ajax-actions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.