• I think I hosed the next blog_id somehow in learning multisite. I successfully imported my first 4 (sites/blogs). Then I went for a big site. I expected blog_id 5 instead I got 23. blog_count in sitemeta said I had 4 sites. Isn’t 5 logical? How does multisite determine the next blog_id and where is the database is it stored?

    Thanks

    Wallace

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Dion Hulse

    (@dd32)

    Meta Developer

    Hi @wshealy,

    Internally, WordPress doesn’t need the blog_ids to be sequential, skipping numbers won’t cause issues.

    Deleting a site will cause that ID not to be re-used (the site will usually continue to exist anyway, occupying that ID, just marked as deleted/inaccessible). But in the event that a site is completely erased, that ID would normally still not be re-used, just to prevent any issues around cache or stored IDs elsewhere.

    Once a site is created however, changing the ID of it (without destroying the site and re-creating it) is not advisable for many reasons unless you’re 100% sure you know what you’re getting into ??

    How does multisite determine the next blog_id and where is the database is it stored?

    WordPress relies upon MySQL (or MariaDB, whatever provides your DB) to provide it the blog ID, the conversation goes something like..

    WordPress: Hey MySQL, store these new Blog details!
    MySQL: Ok! That’s ID 23.

    This comes from the AUTO_INCREMENT table field on the wp_blogs table, MySQL keeps track of the next ID that should be used when a record is inserted. It’s possible to set it to 1,000 when creating a table, and records will be created with IDs 1000, 1001, 1002 skipping IDs 1~999.

    If you were to delete the blog_id 23, all of it’s table, and ensure it no longer exists within wp_blogs you could then reset the Auto Increment value on the table to the next ID you wish to be used, such as 5.

    But just to re-iterate, skipping IDs 5-22 is not a problem, WordPress will continue to operate as normal, blog counts won’t be incorrect, WordPress will actually count the records in the database.

    Thread Starter wshealy

    (@wshealy)

    Dion, Thanks this was very helpful. I was over my head and thanks to you I understood so I guess I’m a little taller.

    Thanks
    Wallace

    Thread Starter wshealy

    (@wshealy)

    Dion @dd32

    Got everything cleaned up and working fine.

    It is my week to be over my head, recovering from surgery Friday.

    This one I have tried and tried to fix https://www.ads-software.com/support/topic/updating-failed-the-response-is-not-a-valid-json-response-61/#post-16999307

    I have tried to migrate it to site builder but I a couple of pages of to dos/get working. Is there a place to contribute my thinking about site builder?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multisite next blog_id’ is closed to new replies.