Supondo que você esteja usando a função padrão column_cb (), a tabela listará os IDs das linhas selecionadas em uma matriz em $ _GET, rotulada como o que você designou para 'singular' no construtor da tabela de listas.
Aqui está um típico column_cb ():
function column_cb($item){
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("video")
/*$2%s*/ $item->id //The value of the checkbox should be the record's id
);
}
Por exemplo, digamos que eu tenha uma tabela de listas que exiba vídeos. O construtor ficaria assim:
function __construct(){
global $status, $page;
//Set parent defaults
parent::__construct( array(
'singular' => 'video', //singular name of the listed records
'plural' => 'videos', //plural name of the listed records
'ajax' => false //does this table support ajax?
) );
}
Portanto, se você marcar três linhas na lista, selecionar "Excluir" na lista de ações em massa e clicar em aplicar, poderá acessar as linhas selecionadas usando $ _GET ['video'].
function process_bulk_action() {
//Detect when a bulk action is being triggered...
if( 'delete'===$this->current_action() ) {
foreach($_GET['video'] as $video) {
//$video will be a string containing the ID of the video
//i.e. $video = "123";
//so you can process the id however you need to.
delete_this_video($video);
}
}
}