Using WP_List_Table in a plugin Using WP_List_Table in a plugin wordpress wordpress

Using WP_List_Table in a plugin


Yes, you have to create a child class to extend the properties of the parent class. I duplicated the wp-admin/plugins.php and wp-admin/includes/class-wp-plugins-list-table.php and moved those files into my plugin.

I then did the whole backwards engineering thing to make it work with the current plugin I was working on. I also found a bug in the process that has already been reported and being worked on.

The bug is found on http://core.trac.wordpress.org/ticket/15386.

In short this never executed when the child class is executed from a plugin.

list($columns, $hidden) = $this->get_column_info();

As a work around I commented out the above code and feed the method directly with what it was looking for:

$columns = $this->get_columns();$hidden  = $sortable = array();

If you have hidden or sortable columns you can call their methods directly as well, but I didn't need them for my implementation.

After a few hours I now understand what the class is doing and I have a working model. and when the bug is fixed, it'll be a little nicer ;)