How do I get WordPress to refresh my wp_list_table after bulk_delete

Question

I have a wp_list_table that is functioning, ie – I can add records to the table, delete individual records, edit individual records, and delete bulk records. Only one issue. After I do a bulk delete the records deleted still show in the list. When I refresh the page, they are gone. What is confusing is that the count of records is correct. Any help will be appreciated. Here is my process_bulk_action function. Thanks,

    public function process_bulk_action() {
    global $wpdb;
    $table = $wpdb->prefix . 'golf_pool_teams';
   // security check!
    if ( isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ) {
        $nonce  = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
        $action = 'bulk-' . $this->_args['plural'];
        if ( ! wp_verify_nonce( $nonce, $action ) )
            wp_die( 'Nope! Security check failed!' );
    }
    $action = $this->current_action();

    if ( isset($_POST['team_id'])) {
        $row_id = $_POST['team_id'];
        switch ( $action ) {
            case 'delete':
                foreach($row_id as &$row){
                    $wpdb->delete($table, array('ID' =>$row));
                }
              break;

            default:
                // do nothing
                return;
                break;
            }
        return;
    } 
}            
0
Bud 4 months 2020-12-18T17:10:36-05:00 0 Answers 9 views 0

Leave an answer

Browse
Browse