0

I'm making a new multisite install and would like my 'registration' blog id to be '1' (done), my 'template' blog id to be '2' (done), and then all subsequent subsites to start with a different blog id, like, 10,000. And, in case I add future template blogs, I would also like them to have a low id, like '3' and '4', not a high id like '10,003'.

Any suggestions?

Motivation: This is to mainly help organize my blogs and to separate my user blogs from my admin blogs.

  • 2
    This is a bad idea. The IDs are primary keys in the database, you shouldn't shuffle them around. You could rather add a filter to the sites list table. – fuxia Jun 19 '15 at 15:06
  • I only want this at sub-site creation, not to re-'id'/move existing blogs. – JJ Rohrer Jun 19 '15 at 15:48
  • you will have to edit the database directly and manipulate the AUTO_INCREMENT value of blog_id column in the wp_blogs table before each new site is created. as has been noted, this is generally a bad idea and should be avoided. – Milo Jun 22 '15 at 15:47
  • @Milo - it really seems like there should be a more graceful method. I didn't make the connection with the blog_id in wp_blogs, but that totally makes sense, thanks. I'm still hoping for a more elegant solution. – JJ Rohrer Jun 22 '15 at 16:32
  • I understand the need to setup an organizational scheme for your blogs, but relying on the range of the ID doesn't seem like the way to do it. Rather than saying "IDs in this range mean this and IDs in that range mean that" maybe trying setting an option that explicitly declares the type of blog. More background may yield a better solution. – Mathew Tinsley Jun 22 '15 at 18:20
1

In MySQL

ALTER TABLE wp_blogs AUTO_INCREMENT = 10000;

Than create the new site and switch back the auto_increment

ALTER TABLE wp_blogs AUTO_INCREMENT = 3;
  • There shouldn't be any issues unless you reach 10000 future blogs. – Radu Dragomir Jun 26 '15 at 14:55
  • In my initial test, upping the auto-increment worked fine, but I had issues resetting to a low number, which makes sense. In as PhpMyAdmin simply wouldn't let me set it to a low number. – JJ Rohrer Jun 30 '15 at 18:45
  • You are right, it will not let you update to a lower number. What you could do is manualy update the 1001 newly created to 3. You need to update all tables names from wp_1001 to wp_3 and in wp_meta all entries with key starting with wp_1001. – Radu Dragomir Jul 1 '15 at 8:06
  • Ok - I'll now accept my question is about trying to do a bad thing - thanks for helping me think through it. I suppose the wordpress way would be to assign categories to the blogs, but I really want to look directly at the table and differentiate my client blogs from my template blogs, just like in wp_events I can separate a 'page' from a 'post'. Thanks! – JJ Rohrer Jul 2 '15 at 13:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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