WP_Terms_List_Table::column_name( WP_Term $tag ): string

In this article

Parameters

$tagWP_Termrequired
Term object.

Return

string

Source

public function column_name( $tag ) {
	$taxonomy = $this->screen->taxonomy;

	$pad = str_repeat( '— ', 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" aria-label="%s">%s</a>',
			esc_url( $edit_link ),
			/* translators: %s: Taxonomy term name. */
			esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
			$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;
}

Hooks

apply_filters( ‘editable_slug’, string $slug, WP_Term|WP_Post $tag )

Filters the editable slug for a post or term.

apply_filters( ‘quick_edit_enabled_for_taxonomy’, bool $enable, string $taxonomy )

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

apply_filters( ‘term_name’, string $pad_tag_name, WP_Term $tag )

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

User Contributed Notes

You must log in before being able to contribute a note or feedback.