I’m building a WP plugin and I get this error:
Fatal error: Class ‘FT_WP_Table’ not found in
/var/www/html/wp-content/plugins/frequent-traveler/frequent-traveler.php
on line 90
This is what I did in my code:
add_action('init', 'uploadFileImportCSV');
function uploadFileImportCSV()
{
$wp_error = true;
global $wpdb;
$nonce = isset($_POST['_wpnonce']) ? $_POST['_wpnonce'] : null;
if (!class_exists('WP_List_Table')) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
class FT_WP_Table extends WP_List_Table
{
.....
}
}
}
Should I get out the class from uploadFileImportCSV()
method? Where is my error?
You have to check for
WP_List_Table
and declare the class at the root of the plugin:Here’s a full example.