public static function site_serve_custom_bulk_action() { // 1. get the action $wp_list_table = _get_list_table('WP_Posts_List_Table'); $wp_site_serve = new SiteServe(); $action = $wp_list_table->current_action(); $post_ids = $_GET['post']; // 2. security check switch ($action) { // 3. Perform the action case 'update_status': foreach ($post_ids as $post_id) { $wp_site_serve->updateLeadStatus($post_id); } // build the redirect url $sendback = add_query_arg(array('post_type' => 'site_serve_lead', 'updated' => $updated, 'ids' => join(',', $post_ids)), $sendback); break; case 'resend_lead': foreach ($post_ids as $post_id) { $data = get_post_meta($post_id); if (!empty($data)) { $data = self::postMetaKeyToArray($data); $status = $wp_site_serve->sendLead($data); wp_delete_post($post_id); } } $sendback = add_query_arg(array('post_type' => 'site_serve_lead', 'updated' => $updated), $sendback); break; default: return; } // 4. Redirect client wp_redirect($sendback); exit; }