8

I have a local multisite installation I use for development with a relatively large number of sites set up. Every site has its own numbered database tables (i.e. wp_n_links, wp_n_options, wp_n_postmeta etc.)

Every time I need to look at a database table in phpMyAdmin I have to look through all the wp_n_options tables to find the tables for the site I need and with a lot of sites this can get a bit tedious!

Is there a better way to find out which tables belong to which site?

5
  • How are you looking at database tables, in PHPMyAdmin? – birgire Feb 23 '16 at 12:38
  • Sorry, should have mentioned that, yes in phpMyAdmin. – Cai Feb 23 '16 at 12:40
  • are you looking for a way to find the blog_id for a given site (like tsipilai shows) or are you looking for a way to display all tables related to a given table prefix (my understanding)? – birgire Feb 23 '16 at 14:26
  • Well, now i realise I'm looking for the blog_id for a given site. I didn't realise the number in the table name corresponded to the blog_id.. I feel a bit stupid now. – Cai Feb 23 '16 at 14:31
  • no problem, please don't feel that. I just thought you're looking for some general search tools within PHPMyAdmin ;-) – birgire Feb 23 '16 at 14:42
7

The number you refer to is the blog/site ID, so you have multiple methods of finding out which site it is:

  • Look in the sites table, the number should match the ID, providing you with a URL and title
  • Go to example.com/wp-admin/network/site-info.php?id=insert-number-here and you'll be shown the network admin UI for that site
  • Consider a plugin or custom column in the sites area of the network admin that displays the blog ID
8

Look the wp_blogs table, theres "blog_id" and "path" to identify that. Does it help?

2
  • That actually does help! I didn't realise the blog_id corresponded to the numbers in the table names. – Cai Feb 23 '16 at 14:32
  • +1, but the one thing to be aware of is that AFAIK the domain mapping plugins use their own setting area so if you use them this might not give you the mapped domain. – Mark Kaplun Feb 23 '16 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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