WP_Media_List_Table::column_cb()publicWP 4.3.0

Handles the checkbox column output.

Метод класса: WP_Media_List_Table{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WP_Media_List_Table = new WP_Media_List_Table();
$WP_Media_List_Table->column_cb( $item );
$item(WP_Post) (обязательный)
The current WP_Post object.

Список изменений

С версии 4.3.0 Введена.
С версии 5.9.0 Renamed $post to $item to match parent class for PHP 8 named parameter support.

Код WP_Media_List_Table::column_cb() WP 6.5.2

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

	if ( current_user_can( 'edit_post', $post->ID ) ) {
		?>
		<input type="checkbox" name="media[]" id="cb-select-<?php echo $post->ID; ?>" value="<?php echo $post->ID; ?>" />
		<label for="cb-select-<?php echo $post->ID; ?>">
			<span class="screen-reader-text">
			<?php
			/* translators: Hidden accessibility text. %s: Attachment title. */
			printf( __( 'Select %s' ), _draft_or_post_title() );
			?>
			</span>
		</label>
		<?php
	}
}