wpdb - How to get a list of WordPress default database tables?

Is there any solution to get a list of default database tables in WordPress?I have used $wpdb->tables() but even with

Is there any solution to get a list of default database tables in WordPress?

I have used $wpdb->tables() but even with blog argument, it returns a list that includes other tables too. (I have some plugins and they have created some more tables in database)

Is there any solution to get a list of default database tables in WordPress?

I have used $wpdb->tables() but even with blog argument, it returns a list that includes other tables too. (I have some plugins and they have created some more tables in database)

Share Improve this question asked Apr 16, 2019 at 5:35 HectorHector 6821 gold badge7 silver badges18 bronze badges 4
  • Programmatically or just to get that list? It doesn’t change as often, so hardcoding it isn’t that bad solution, I guess... – Krzysiek Dróżdż Commented Apr 16, 2019 at 5:48
  • I don't like hardcoding and writing the list manually. Searching for codes to do that. – Hector Commented Apr 16, 2019 at 5:50
  • I'm curious, what do you need it for? – Jacob Peattie Commented Apr 16, 2019 at 6:11
  • I need to show the size of each table as info for the user. But I don't like to include 3rd-party tables. – Hector Commented May 9, 2019 at 7:48
Add a comment  | 

1 Answer 1

Reset to default 1

There is no programmatic way to get a list of default tables. WordPress does not store a list of them anywhere. The closest thing there is is wp_get_db_schema(). This function returns the raw SQL used to create the default tables, but as you can see from the source, it doesn't derive it from another source, it is where the default tables are originally defined. Maybe you could parse the SQL to figure it out, but I'm not sure why you'd need to.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745585051a4634484.html

相关推荐

  • wpdb - How to get a list of WordPress default database tables?

    Is there any solution to get a list of default database tables in WordPress?I have used $wpdb->tables() but even with

    14小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信