wp_ajax_inline_save()
- Since
- 3.1.0
- Source
wp-admin/includes/ajax-actions.php:2085
Compatibility
- 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_inline_save() 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
- Scales with input
- Instructions
- 102–178
- Plugin surface
- 1 hook
- Called by
- 0
Reaches the database via get_post().
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 245.
Third-party callbacks on 'quick_edit_show_taxonomy' run inside this call, and their cost is not bounded by anything here.
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
apply_filters()called directly - optionoption read or write
get_option()one call below wp_ajax_inline_save()
Further down the call graph this can also reach 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 · 12 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_ajax_inline_save() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($value) && current_user_can() && !is_post_type_hierarchical() | 102–123 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_slash(), get_current_user_id(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), wp_die() |
!isset($value) && current_user_can() && !is_post_type_hierarchical() | 104–125 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_die(), wp_slash(), get_current_user_id(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), wp_die() |
!isset($value) && current_user_can() && is_post_type_hierarchical() && !$parent | 114–135 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_slash(), get_current_user_id(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), get_post(), wp_die() |
!isset($value) && current_user_can() && is_post_type_hierarchical() && !$parent | 116–137 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_die(), wp_slash(), get_current_user_id(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), get_post(), wp_die() |
!isset($value) && current_user_can() && !empty($data) && !is_post_type_hierarchical() | 126–144 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_slash(), get_current_user_id(), wp_unique_post_slug(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), wp_die() |
!isset($value) && current_user_can() && !empty($data) && !is_post_type_hierarchical() | 128–146 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_die(), wp_slash(), get_current_user_id(), wp_unique_post_slug(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), wp_die() |
!isset($value) && current_user_can() && !isset($data) && !is_post_type_hierarchical() | 129–145 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_userdata(), __(), __(), esc_html(), printf(), wp_die(), get_post(), wp_slash(), get_current_user_id(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), wp_die() |
!isset($value) && current_user_can() && !empty($data) && is_post_type_hierarchical() && !$parent | 138–156 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_slash(), get_current_user_id(), wp_unique_post_slug(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), get_post(), wp_die() |
!isset($value) && current_user_can() && !empty($data) && is_post_type_hierarchical() && !$parent | 140–158 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_post(), wp_die(), wp_slash(), get_current_user_id(), wp_unique_post_slug(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), get_post(), wp_die() |
!isset($value) && current_user_can() && !isset($data) && is_post_type_hierarchical() && !$parent | 141–157 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_userdata(), __(), __(), esc_html(), printf(), wp_die(), get_post(), wp_slash(), get_current_user_id(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), get_post(), wp_die() |
!isset($value) && current_user_can() && !isset($data) && !empty($data) && !is_post_type_hierarchical() | 153–166 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_userdata(), __(), __(), esc_html(), printf(), wp_die(), get_post(), wp_slash(), get_current_user_id(), wp_unique_post_slug(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), wp_die() |
!isset($value) && current_user_can() && !isset($data) && !empty($data) && is_post_type_hierarchical() && !$parent | 165–178 | check_ajax_referer(), wp_die(), current_user_can(), wp_check_post_lock(), get_userdata(), __(), __(), esc_html(), printf(), wp_die(), get_post(), wp_slash(), get_current_user_id(), wp_unique_post_slug(), edit_post(), screen(), is_post_type_hierarchical(), get_post(), get_post(), wp_die() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 244 | 102–177 | 24 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 245 | 102–178 | 24 | |
| 8.4 | 245 | 102–178 | 24 | |
| 8.3 | 245 | 102–178 | 24 | |
| 8.2 | 245 | 102–178 | 24 | |
| 8.1 | 245 | 102–178 | 24 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 246 | 102–178 | 24 |
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.
Hooks and filters fired · 1
One hook fires while wp_ajax_inline_save() runs, in this order:
- apply_filters( quick_edit_show_taxonomy )filterline 2165 (+80 into the body)
Filters whether the current taxonomy should be shown in the Quick Edit panel.
Uses · 16
- check_ajax_referer()Verifies the Ajax request to prevent processing requests external of the blog.
- wp_die()Kills WordPress execution and displays HTML page with an error message.
- current_user_can()Returns whether the current user has the specified capability.
- __()Retrieves the translation of $text.
- wp_check_post_lock()Determines whether the post is currently being edited by another user.
- get_userdata()Retrieves user info by user ID.
- esc_html()Escaping for HTML blocks.
- get_post()Retrieves post data given a post ID or post object.
- wp_slash()Adds slashes to a string or recursively adds slashes to strings within an array.
- get_current_user_id()Gets the current user's ID.
- get_taxonomy()Retrieves the taxonomy object of $taxonomy.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Show all 16
- wp_unique_post_slug()Computes a unique slug for the post, when given the desired slug and some post details.
- edit_post()Updates an existing post with values provided in `$_POST`.
- _get_list_table()Fetches an instance of a WP_List_Table class.
- is_post_type_hierarchical()Determines whether the post type is hierarchical.
Source code
function wp_ajax_inline_save() { global $mode; check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) { wp_die(); } $post_id = (int) $_POST['post_ID']; if ( 'page' === $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); } } else { if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } } $last = wp_check_post_lock( $post_id ); if ( $last ) { $last_user = get_userdata( $last ); $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); /* translators: %s: User's display name. */ $msg_template = __( 'Saving is disabled: %s is currently editing this post.' ); if ( 'page' === $_POST['post_type'] ) { /* translators: %s: User's display name. */ $msg_template = __( 'Saving is disabled: %s is currently editing this page.' ); } printf( $msg_template, esc_html( $last_user_name ) ); wp_die(); } $data = &$_POST; $post = get_post( $post_id, ARRAY_A ); if ( ! $post ) { wp_die(); } // Since it's coming from the database. $post = wp_slash( $post ); $data['content'] = $post['post_content']; $data['excerpt'] = $post['post_excerpt']; // Rename. $data['user_ID'] = get_current_user_id(); if ( isset( $data['post_parent'] ) ) { $data['parent_id'] = $data['post_parent']; } // Status. if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) { $data['visibility'] = 'private'; $data['post_status'] = 'private'; } elseif ( isset( $data['_status'] ) ) { $data['post_status'] = $data['_status']; } if ( empty( $data['comment_status'] ) ) { $data['comment_status'] = 'closed'; } if ( empty( $data['ping_status'] ) ) { $data['ping_status'] = 'closed'; } // Exclude terms from taxonomies that are not supposed to appear in Quick Edit. if ( ! empty( $data['tax_input'] ) ) { foreach ( $data['tax_input'] as $taxonomy => $terms ) { $tax_object = get_taxonomy( $taxonomy ); /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */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 7.1.0 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.