0

I Developed a plugin I wanted to show data in wordpress table in admn area for which Wp_List_Table clas is used to do that I tried to use this but the problem is that it not being able to properly implement something is wrong I do not know what this is wrong which is causing this error so now let me define what exactly is the problem First let me post the code of my plugin along with file path

plugin-directory/inc/admin/Admin.php

namespace Inc\admin;

class Admin {
        public static function get_vendors() {
        require_once PLUGIN_PATH . 'inc/admin/MV_Vendors.php';

        $tableData = new MV_Vendors();

        $tableData->prepare_items();

        return $tableData->display();
    }

    public function admin_page_mv_vendors() {
        $vendors = self::get_vendors();
        
        require_once( PLUGIN_PATH . 'inc/admin/pages/template-all-vendors.php');
    }
}

plugin-directory/inc/admin/MV_Vendors.php

namespace Inc\admin; 

require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';

class MV_Vendors extends WP_List_Table {
     //code will go here
}

So now here is what error I am getting is given below

Uncaught Error: Class 'Inc\admin\WP_List_Table' not found in /home/codebkpa/public_html/venuebooking/wp-content/plugins/multi-vendor/inc/admin/MV_Vendors.php:10 Stack trace: #0

please can anyone help me out why i am getting hthis unusual error

0

You've specified a namespace, so PHP is looking for that class in the namespace Inc\admin

You can tell it to use the root namespace where that class is probably defined with a leading \ like:

class MV_Vendors extends \WP_List_Table {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.