wp_ajax_wp_fullscreen_save_post()
- Since
- 3.1.0
- Source
wp-admin/includes/ajax-actions.php:2870
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
- Scaling
- Constant
- Instructions
- 55–82
- Plugin surface
- None
- Called by
- 0
Reaches the database via get_post().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 106.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- querycontent query
get_post()called directly - hookthird-party callbacks
do_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.
| When | Instructions | Calls it makes |
|---|---|---|
!is_wp_error() | 55–58 | check_ajax_referer(), edit_post(), is_wp_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), __(), sprintf(), last_edited() |
is_wp_error() | 57–60 | 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() | 59–62 | get_post(), check_ajax_referer(), edit_post(), is_wp_error(), __(), date_i18n(), __(), date_i18n(), get_post_meta(), __(), sprintf(), last_edited() |
is_wp_error() | 61–64 | get_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–65 | check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited() |
is_wp_error() | 64–67 | check_ajax_referer(), edit_post(), is_wp_error(), wp_send_json_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited() |
!is_wp_error() | 66–69 | get_post(), check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), __(), sprintf(), last_edited() |
!is_wp_error() | 66–69 | 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() | 68–71 | get_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–71 | 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() |
!is_wp_error() | 70–73 | get_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–75 | get_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–76 | check_ajax_referer(), edit_post(), is_wp_error(), __(), mysql2date(), __(), mysql2date(), get_post_meta(), get_userdata(), __(), esc_html(), sprintf(), last_edited() |
is_wp_error() | 75–78 | check_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–80 | get_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–82 | get_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
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 106 | 55–82 | 5 | |
| 8.5 | 106 | 55–82 | 5 | |
| 8.4 | 106 | 55–82 | 5 | |
| 8.3 | 106 | 55–82 | 5 | |
| 8.2 | 106 | 55–82 | 5 | |
| 8.1 | 106 | 55–82 | 5 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 107 | 55–83 | 5 |
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.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 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.