最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - is it recommended to use WP_List_Table?

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论