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)

  • Programmatically or just to get that list? It doesn’t change as often, so hardcoding it isn’t that bad solution, I guess... 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? 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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.