WP_Links_List_Table::column_cb() WordPress Method

The WP_Links_List_Table::column_cb() method is used to generate the checkbox column for the links list table. This method is called when the links list table is being rendered. It contains a checkbox for each link in the list, allowing the user to select one or more links for bulk actions. The WP_Links_List_Table::column_cb() method is used internally by the Wordpress links list table class. It should not be called directly by plugins or themes.

WP_Links_List_Table::column_cb( object $item ) #

Handles the checkbox column output.


Parameters

$item

(object)(Required)The current link object.


Top ↑

Source

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

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

		?>
		<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>">
			<?php
			/* translators: %s: Link name. */
			printf( __( 'Select %s' ), $link->link_name );
			?>
		</label>
		<input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
		<?php
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Renamed $link to $item to match parent class for PHP 8 named parameter support.
4.3.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.