I want to display a message for each of the results.
I am having a problem with this line here:
[php]foreach($category_delete as $category_delete_result){//List each category that has been deleted[/php]
Here is the rest of my code:
[php]
if ($_POST[‘bulk_action’] == ‘delete’ && !empty($_POST[‘checkbox’])) {//Check if delete option is selected and check if boxes are ticked
foreach($_POST[‘checkbox’] as $check_id) {//Delete each box that has been ticked
$get_category_details = $wpdb->get_results('SELECT name FROM ’ . $wpdb->prefix . ‘terms WHERE term_id=’ . $check_id);//Get name of deleted category
$category_delete = wp_delete_category($check_id);
foreach($category_delete as $category_delete_result){//List each category that has been deleted
if($category_delete_result){// if successful
foreach($get_category_details as $category_details) {
$actionMessage = "<strong>Success!</strong> Deleted the category: <strong>".$category_details->name."</strong> from the database!";
}
}//END if successful
else {// failure to delete category
foreach($get_category_details as $category_details) {
$actionMessage = "<strong>Warning!</strong> Failed to delete the category: <strong>".$category_details->name."</strong> from the database!";
}
}//END failure to delete category
}//END List each category that has been deleted
}//END Delete each box that has been ticked
}//END Check if delete option is selected and check if boxes are ticked
[/php]