wppaste
WordPress

get_inline_data( WP_Post $post )

Since
2.7.0
Source
wp-admin/includes/template.php:311
Adds hidden fields with the data for use in the inline editor for posts and pages.

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

Reaches the database via wp_get_object_terms().

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
15–196

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

Plugin surface
2 hooks

Third-party callbacks on 'editable_slug', 'add_inline_data' run inside this call, and their cost is not bounded by anything here.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • querycontent querywp_get_object_terms()called directly
  • cacheobject cachewp_cache_add()called directly
  • optionoption read or writeget_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.

WhenInstructionsCalls it makes
!current_user_can()15get_post_type_object(), current_user_can()
current_user_can() && !$post && !post_type_supports() && $post_type_object159–168get_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_object165–174get_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–179get_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–179get_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–185get_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–185get_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–190get_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–196get_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

PHPCompiledExecutedBranchesNotes
8.6-dev27715–195142 fewer instructions than PHP 8.5
8.527915–19614
8.427915–196148 fewer instructions than PHP 8.3
8.328715–19814
8.228715–19814
8.128715–19814
7.428715–19814

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:

  1. apply_filters( editable_slug )filterline 323 (+12 into the body)

    Filters the editable slug for a post or term.

  2. 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

Show all 17

Used by · 1

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.8

Changelog

Introduced in 2.7.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.

About this page

Parsed data
Generated from the wordpress-develop 6.9.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.