How to use WP default post list tables in a plugin?

You came to this in a bad time of changes. Tables in admin are being migrated from the old and scary ways to new shiny List Tables API using subclasses of WP_List_Table.

Problem is – while classes are already in and being using core code, they are currently not meant for being used otherwise. Proper API for theme/plugin usage is planned, but I think it didn’t make it in 3.2 version, so 3.3 (at best).

Your options are:

  1. Do custom table, reuse CSS styling from core. Long run – leave as is or recode when List Table API is implemented and finalized.

  2. Extend appropriate WP_List_Table class with your own and use that. Long run – likely watch it explode at every following WP version from here until List Table API is implemented and finalized.

For simple things I’d prefer 1. But for complex stuff 2 is pretty much only way to go, because custom table is very hard to get right when a lot of global variables and other joys of admin side are involved.

Leave a Comment