wppaste
WordPress

WP_Terms_List_Table::column_name( WP_Term $tag ): string

Source
wp-admin/includes/class-wp-terms-list-table.php:383

Compatibility

WordPress
core
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

$tagWP_Term
Term object.

Return value

string

Performance profile

How much work a call to WP_Terms_List_Table::column_name() 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_term().

Scaling
Constant

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

Instructions
56–101

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

Plugin surface
3 hooks

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

Called by
0

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

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • querycontent queryget_term()called directly

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 · 8 distinct outcomes

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

WhenInstructionsCalls it makes
!wp_doing_ajax()56str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), get_edit_term_link(), apply_filters()
wp_doing_ajax()58str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), wp_get_referer(), get_edit_term_link(), apply_filters()
!wp_doing_ajax()77str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), get_edit_term_link(), wp_unslash(), urlencode(), add_query_arg(), esc_url(), apply_filters()
!wp_doing_ajax()78str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), get_edit_term_link(), apply_filters(), apply_filters()
wp_doing_ajax()79str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), wp_get_referer(), get_edit_term_link(), wp_unslash(), urlencode(), add_query_arg(), esc_url(), apply_filters()
wp_doing_ajax()80str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), wp_get_referer(), get_edit_term_link(), apply_filters(), apply_filters()
!wp_doing_ajax()99str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), get_edit_term_link(), wp_unslash(), urlencode(), add_query_arg(), esc_url(), apply_filters(), apply_filters()
wp_doing_ajax()101str_repeat(), apply_filters(), get_term(), wp_doing_ajax(), wp_get_referer(), get_edit_term_link(), wp_unslash(), urlencode(), add_query_arg(), esc_url(), apply_filters(), apply_filters()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev10256–10031 fewer instruction than PHP 8.5
8.510356–1013
8.410356–10135 fewer instructions than PHP 8.3
8.310861–1063
8.210861–1063
8.110861–10631 fewer instruction than PHP 7.4
7.410962–1063

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 · 3

3 hooks fire while WP_Terms_List_Table::column_name() runs, in this order:

  1. apply_filters( term_name )filterline 401 (+18 into the body)

    Filters display of the term name in the terms list table.

  2. apply_filters( quick_edit_enabled_for_taxonomy )filterline 428 (+45 into the body)

    Filters whether Quick Edit should be enabled for the given taxonomy.

  3. apply_filters( editable_slug )filterline 435 (+52 into the body)

    Filters the editable slug for a post or term.

Uses · 8

Source code

	public function column_name( $tag ) {		$taxonomy = $this->screen->taxonomy; 		$pad = str_repeat( '&#8212; ', max( 0, $this->level ) ); 		/**		 * Filters display of the term name in the terms list table.		 *		 * The default output may include padding due to the term's		 * current level in the term hierarchy.		 *		 * @since 2.5.0		 *		 * @see WP_Terms_List_Table::column_name()		 *		 * @param string $pad_tag_name The term name, padded if not top-level.		 * @param WP_Term $tag         Term object.		 */		$name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 		$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 		$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; 		$edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ); 		if ( $edit_link ) {			$edit_link = add_query_arg(				'wp_http_referer',				urlencode( wp_unslash( $uri ) ),				$edit_link			);			$name      = sprintf(				'<a class="row-title" href="%s">%s</a>',				esc_url( $edit_link ),				$name			);		} 		$output = sprintf(			'<strong>%s</strong><br />',			$name		); 		/** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */		$quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy ); 		if ( $quick_edit_enabled ) {			$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';			$output .= '<div class="name">' . $qe_data->name . '</div>'; 			/** This filter is documented in wp-admin/edit-tag-form.php */			$output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';			$output .= '<div class="parent">' . $qe_data->parent . '</div></div>';		} 		return $output;	}

Changelog

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 7.1.0 tag, from src/wp-admin/includes/class-wp-terms-list-table.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.