1

In the WordPress codex, following is highlighted in red for WP List Table.

"This class's access is marked as private. That means it is not intended for use by plugin and theme developers as it is subject to change without warning in any future WordPress release.".

Is there any way to add bulk action and sorting functionalities like (WP_List_Table is doing) in custom plugins and how to use it?

  • 2
    When you use that class, normally you write a class that extend it, so change in parent class not always affect the yours. In addition, even if is marked as private you can use it. Only be sure to test your plugin everytime a new WordPress version is released in beta. Consider that many of most popular WordPress plugins extensively uses that class right now (a name? WooCommerce), so, if I know WordPress a little, (and I work with WP since almost 10 years) before make some significant change to that class it will be announced, largely discussed and probably not done at all. – gmazzap Mar 18 '14 at 14:49
  • 2
    See this post about WP_List_Table. – bueltge Mar 18 '14 at 21:21
  • Currently the question is much too broad. Could you please show us what you already tried and where you are stuck? – kaiser Mar 21 '14 at 14:46
2

If WP_List_Table is working for you, then you can just make a copy of this class. And use that.

In the WordPress codex, Also says:

If you would still like to make use of the class, you should make a copy to use and distribute with your own project.

You may define a new class so that it will not interfere with the existing WP_List_Table Class.

abstract class Legacy_WP_List_Table {
   //Code from WP_List_Table
}

Then you can extend this class and use it like:

class MY_List_Table extends Legacy_WP_List_Table {
 //Your implementation here
}

This way if Wordpress remove or change the class will not affect your implementation.

2

For using the WP_List_Table functionality in a custom plugin, we can do one thing like below:

1. Copy the file class-wp-list-table.php to your plugin folder.
2. Then include that file in your plugin and extend the WP_List_Table (or else you can rename the class) class.
3. If we need any modification, we can do that from there.

In this way,we can add bulk action and sorting functionalities like (WP_List_Table is doing) in custom plugins and so no need to test our plugin everytime a new WordPress version is released.

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.