Handles the checkbox column output.
Parameters
Source
public function column_cb( $item ) {
// Restores the more descriptive, specific name for use within this method.
$post = $item;
$show = current_user_can( 'edit_post', $post->ID );
/**
* Filters whether to show the bulk edit checkbox for a post in its list table.
*
* By default the checkbox is only shown if the current user can edit the post.
*
* @since 5.7.0
*
* @param bool $show Whether to show the checkbox.
* @param WP_Post $post The current WP_Post object.
*/
if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) :
?>
<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
<label for="cb-select-<?php the_ID(); ?>">
<span class="screen-reader-text">
<?php
/* translators: %s: Post title. */
printf( __( 'Select %s' ), _draft_or_post_title() );
?>
</span>
</label>
<div class="locked-indicator">
<span class="locked-indicator-icon" aria-hidden="true"></span>
<span class="screen-reader-text">
<?php
printf(
/* translators: Hidden accessibility text. %s: Post title. */
__( '“%s” is locked' ),
_draft_or_post_title()
);
?>
</span>
</div>
<?php
endif;
}
Hooks
- apply_filters( ‘wp_list_table_show_post_checkbox’,
bool $show ,WP_Post $post ) Filters whether to show the bulk edit checkbox for a post in its list table.
User Contributed Notes
You must log in before being able to contribute a note or feedback.