I have tried this on my own code, where I use custom post type and custom database table. I have changed the code a little, but still get the same error. This is the code for the dele:
function column_student($item){
$actions=array(
'edit'=>sprintf('<a href="?post_type=%s&page=%s&action=%s&student=%s">Edit</a>',$_REQUEST['post_type'], $_REQUEST['page'], 'edit', $item->students_id),
'delete'=>sprintf('<a href="?post_type=%s&page=%s&action=%s&student=%s">Delete</a>', $_REQUEST['post_type'], $_REQUEST['page'], 'delete', $item->students_id),
);
//Return the title contents
return sprintf('%1$s <span style="color:silver"></span>%2$s',
/*$1%s*/ $item->students_name,
/*$2%s*/ $this->row_actions($actions)
);
}
function process_bulk_action(){
if( 'delete'===$this->current_action() ) {
$this->bsp_delete_student(($_REQUEST['student']));
}
}
function bsp_delete_student($id){
global $wpdb;
$tablename=$wpdb->prefix."students"; //geting our table name with prefix
$result=$wpdb->query("DELETE FROM '.$tablename.' WHERE students_id='.$id'");
}
function column_cb($item){
return sprintf('<input type="checkbox" name="%1$s" value="%2$s" />',
$this->_args['singular'], //$1%s we use the tables singular label
$item->students_id //$2%s the value of the chechbox is the students id
);
}
The rollover edit and delete are not showing anymore and I don’t know why. But when I click on the apply for bulk action it just redirects me to You do not have sufficient permissions to access this page. In the URL I now see the correct id’s, but nothing happens.
It’s also interesting that when I use your code and just change the database and it’s fields to mine, the mouse over delete “button” is not showing. Is this because I’m working on localhost? And when I try to delete the selected items it gives my an Warning: Cannot modify header information - headers already sent by (…wp-includes\pluggable.php on line 1196, but when I click again on the menu the record is deleted. Any ideas?