get_inline_data( WP_Post $post )
- Since
- 2.7.0
- Source
wp-admin/includes/template.php:311
Compatibility
- WordPress
- since 2.7.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.
Parameters
$postWP_Post- Post object.
Performance profile
How much work a call to get_inline_data() 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
- 15–196
- Plugin surface
- 2 hooks
- Called by
- 1
Reaches the database via wp_get_object_terms().
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 279.
Third-party callbacks on 'editable_slug', 'add_inline_data' run inside this call, and their cost is not bounded by anything here.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly - querycontent query
wp_get_object_terms()called directly - cacheobject cache
wp_cache_add()called directly - optionoption read or write
get_option()one call below get_inline_data()
Further down the call graph this can also reach 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 · 9 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost get_inline_data() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!current_user_can() | 15 | get_post_type_object(), current_user_can() |
current_user_can() && !$post && !post_type_supports() && $post_type_object | 159–168 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), post_type_supports(), get_object_taxonomies(), post_type_supports(), do_action() |
current_user_can() && $post && !post_type_supports() && $post_type_object | 165–174 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), esc_html(), post_type_supports(), get_object_taxonomies(), post_type_supports(), do_action() |
current_user_can() && !$post_type_object && !$post && !post_type_supports() | 169–179 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), post_type_supports(), get_object_taxonomies(), is_sticky(), post_type_supports(), do_action() |
current_user_can() && !$post && $post_type_object && post_type_supports() | 170–179 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), post_type_supports(), get_object_taxonomies(), post_type_supports(), get_post_format(), esc_html(), do_action() |
current_user_can() && !$post_type_object && $post && !post_type_supports() | 175–185 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), esc_html(), post_type_supports(), get_object_taxonomies(), is_sticky(), post_type_supports(), do_action() |
current_user_can() && $post && $post_type_object && post_type_supports() | 176–185 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), esc_html(), post_type_supports(), get_object_taxonomies(), post_type_supports(), get_post_format(), esc_html(), do_action() |
current_user_can() && !$post_type_object && !$post && post_type_supports() | 180–190 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), post_type_supports(), get_object_taxonomies(), is_sticky(), post_type_supports(), get_post_format(), esc_html(), do_action() |
current_user_can() && !$post_type_object && $post && post_type_supports() | 186–196 | get_post_type_object(), current_user_can(), esc_textarea(), apply_filters(), esc_html(), esc_html(), esc_html(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), mysql2date(), esc_html(), esc_html(), post_type_supports(), get_object_taxonomies(), is_sticky(), post_type_supports(), get_post_format(), esc_html(), do_action() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 277 | 15–195 | 14 | 2 fewer instructions than PHP 8.5 |
| 8.5 | 279 | 15–196 | 14 | |
| 8.4 | 279 | 15–196 | 14 | 8 fewer instructions than PHP 8.3 |
| 8.3 | 287 | 15–198 | 14 | |
| 8.2 | 287 | 15–198 | 14 | |
| 8.1 | 287 | 15–198 | 14 | |
| 7.4 | 287 | 15–198 | 14 |
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 · 2
2 hooks fire while get_inline_data() runs, in this order:
- apply_filters( editable_slug )filterline 323 (+12 into the body)
Filters the editable slug for a post or term.
- do_action( add_inline_data )actionline 395 (+84 into the body)
Fires after outputting the fields for the inline editor for posts and pages.
Uses · 17
- get_post_type_object()Retrieves a post type object by name.
- current_user_can()Returns whether the current user has the specified capability.
- esc_textarea()Escaping for textarea values.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- esc_html()Escaping for HTML blocks.
- mysql2date()Converts given MySQL date string into a different format.
- post_type_supports()Checks a post type's support for a given feature.
- get_object_taxonomies()Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name.
- get_taxonomy()Retrieves the taxonomy object of $taxonomy.
- get_object_term_cache()Retrieves the cached term objects for the given object ID.
- wp_get_object_terms()Retrieves the terms associated with the given object(s), in the supplied taxonomies.
- wp_cache_add()Adds data to the cache, if the cache key doesn't already exist.
Show all 17
- wp_list_pluck()Plucks a certain field out of each object or array in an array.
- get_terms_to_edit()Gets comma-separated list of terms available to edit for the given post ID.
- is_sticky()Determines whether a post is sticky.
- get_post_format()Retrieve the format slug for a post
- do_action()Calls the callback functions that have been added to an action hook.
Used by · 1
- WP_Posts_List_Table::column_title()Handles the title column output.
Source code
function get_inline_data( $post ) { $post_type_object = get_post_type_object( $post->post_type ); if ( ! current_user_can( 'edit_post', $post->ID ) ) { return; } $title = esc_textarea( trim( $post->post_title ) ); echo '<div class="hidden" id="inline_' . $post->ID . '"> <div class="post_title">' . $title . '</div>' . /** This filter is documented in wp-admin/edit-tag-form.php */ '<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div> <div class="post_author">' . $post->post_author . '</div> <div class="comment_status">' . esc_html( $post->comment_status ) . '</div> <div class="ping_status">' . esc_html( $post->ping_status ) . '</div> <div class="_status">' . esc_html( $post->post_status ) . '</div> <div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div> <div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div> <div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div> <div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div> <div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div> <div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div> <div class="post_password">' . esc_html( $post->post_password ) . '</div>'; if ( $post_type_object->hierarchical ) { echo '<div class="post_parent">' . $post->post_parent . '</div>'; } echo '<div class="page_template">' . ( $post->page_template ? esc_html( $post->page_template ) : 'default' ) . '</div>'; if ( post_type_supports( $post->post_type, 'page-attributes' ) ) { echo '<div class="menu_order">' . $post->menu_order . '</div>'; } $taxonomy_names = get_object_taxonomies( $post->post_type ); foreach ( $taxonomy_names as $taxonomy_name ) { $taxonomy = get_taxonomy( $taxonomy_name ); if ( ! $taxonomy->show_in_quick_edit ) { continue; } if ( $taxonomy->hierarchical ) { $terms = get_object_term_cache( $post->ID, $taxonomy_name ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy_name ); wp_cache_add( $post->ID, wp_list_pluck( $terms, 'term_id' ), $taxonomy_name . '_relationships' ); } $term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' ); echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>'; } else { $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name ); if ( ! is_string( $terms_to_edit ) ) { $terms_to_edit = ''; } echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">' . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>'; } } if ( ! $post_type_object->hierarchical ) { echo '<div class="sticky">' . ( is_sticky( $post->ID ) ? 'sticky' : '' ) . '</div>'; } if ( post_type_supports( $post->post_type, 'post-formats' ) ) { echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>'; } /** * Fires after outputting the fields for the inline editor for posts and pages. * * @since 4.9.8Changelog
Introduced in 2.7.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/template.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.