So I deleted a few blogs that I no longer needed in my multisite...but I didnt realize that it would create a "gap" in my blogs.

In other words I now have

And the blog-id "2" is now missing. If I try to use that same link for example with "2" appended at the end? The result is "The requested site does not exist" (which is accurate because I did in fact delete it).

Is there a way to create the blog numbers that are missing? I do NOT need to recover their data at all...I just want the missing blog ids to be usable and available.



blog ids have no importance by themselves, it is just an abstract number that uniquely identified a blog in the network. they are assigned sequentially for the convenience of the code and since they don't have any meaning by themselves, there is no reason to "compact" them. In theory it can be done, but it is not especially trivial and will be a waste of your time.

| improve this answer | |
  • I have code that's based on each blogs sequence. The various gaps causes issues w/ the code that would take a while to re-write. Rather than re-write the code, I thought it would be easier to simply add in the missing blogs. Perhaps there is a way to reassign the existing blog id's so that they have no gaps and are once again sequential...? – Erik Malson Oct 4 '16 at 13:16
  • if your code assume anything about the order of blogs then it is buggy and should be fixed – Mark Kaplun Oct 4 '16 at 16:10
  • I agree 100% which is why I'm here :) Its not my code. And instead of fixing the code, which I could do...I actually thought that simply re-creating the "missing" blogs would be MUCH faster than debugging code that I inherited. Can anyone come up with a way to insert the missing blogs into my DB...? – Erik Malson Oct 4 '16 at 18:28
  • it is not simple as there are DB table which have that number in their name. If you must you can rename the id and the table names but this is a dangerous procedure, should be easier and safer to fix the code – Mark Kaplun Oct 4 '16 at 18:33

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.