admin管理员组

文章数量:1431720

At moment i am developing a Wordpress-Plugin where I have to print a custom table in the admin-menu. After a short research I found the solution with WP_List_Table. But on the Class Reference from Wordpress I saw that the class is marked as private, that means it is not intended for use by plugin and theme developers.

So is it recommended to use this class or should I print the table with "plain" php?

At moment i am developing a Wordpress-Plugin where I have to print a custom table in the admin-menu. After a short research I found the solution with WP_List_Table. But on the Class Reference from Wordpress I saw that the class is marked as private, that means it is not intended for use by plugin and theme developers.

https://codex.wordpress/Class_Reference/WP_List_Table

So is it recommended to use this class or should I print the table with "plain" php?

Share Improve this question asked Apr 8, 2019 at 10:51 eh irgendwereh irgendwer 111 bronze badge 1
  • The advice in your link sounds good to me: either use it and accept the risk that it might break at some point (but it's been 7+ years) or make a renamed copy of the class in your plugin and use that instead. – Rup Commented Apr 8, 2019 at 11:00
Add a comment  | 

1 Answer 1

Reset to default 0

The thing we have to say first here is that Codex officially informs that:

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. If you would still like to make use of the class, you should make a copy to use and distribute with your own project, or else use it at your own risk.

So at first glance, it's a bad idea to use it in your plugin. But...

It still is very handy class and it saves you a lot of coding. It also makes very easy to code UI that is consistent with other WP parts...

Another reason to use it is that a lot of plugins do.

So yes - I would go for it and use it in my plugin. But I'd have on my mind that it's a little bit risky and maybe someday my plugin will stop working because of WP update - so I'll have to test it against new versions or track changes in this class.

本文标签: plugin developmentis it recommended to use WPListTable