WP_Terms_List_Table::column_cb() WordPress Method

The column_cb() method is used to generate the checkbox column for the terms list table. This method is called when the 'cb' column is added to the terms list table. The 'cb' column is the checkbox column, which is used to select terms for bulk actions. The column_cb() method accepts two parameters: $term - The term object $column_name - The name of the column The column_cb() method outputs the checkbox for the term.

WP_Terms_List_Table::column_cb( WP_Term $item ) #


Parameters

$item

(WP_Term)(Required)Term object.


Top ↑

Return

(string)


Top ↑

Source

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

	public function column_cb( $item ) {
		// Restores the more descriptive, specific name for use within this method.
		$tag = $item;

		if ( current_user_can( 'delete_term', $tag->term_id ) ) {
			return sprintf(
				'<label class="screen-reader-text" for="cb-select-%1$s">%2$s</label>' .
				'<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />',
				$tag->term_id,
				/* translators: %s: Taxonomy term name. */
				sprintf( __( 'Select %s' ), $tag->name )
			);
		}

		return '&nbsp;';
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.