How to implement WP_List_Table functionality for custom plugins (OR any substitution for wp_list_table plugin) for bulk action

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.”.

Read More

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?

Related posts

2 comments

  1. 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.

Comments are closed.