My client requested quite a specific solution for his WP based wordpress (single site, not multisite). Basically what he wants is, let's say after 1000 posts new database should be created (with 5 tables only, posts, postmeta and 3 taxonomy related tables) and new posts should be stored in this one along with all post meta, until it reaches 1000 posts and then process repeats.

Challenging part is, all these databases have to be active at the same time, so WP should be able to access posts from main db and all these newly created databases (with 5 tables) at the same time. This could probably done with hyperdb. Questions are:

  • How do I tell wp which database to save posts to?
  • Is this even doable to begin with?
  • If so, can it be done without modifications to WP core?
  • The real question here is, why? And, does it really make sense to do it this way? Or is there a better solution to achieve the why. – Nicolai Mar 12 '15 at 22:10

It is not doable if you want to keep around all wordpress features. Possible casualties of such configuration are search and RSS feeds, probably also category and author pages.

If you go and actually create a new DB for each 1k posts then the game ends here as there is no simple way to share data between different databases. If you just want to create new tables every 1k posts then it will like multi site feature that require searching over the whole network, not elegant but possible.

As for the explicit points

  1. it is harder because of the artifcial number limit. Most schemes which distribute data between DBs that I know are based on some hashing of the url, but that reuires to have all the DBs setup from day 1 and not waiting to fill a quota before creting the next DB.

  2. It is if the owner of the site agrees to crippled functionally. For example it might be ok for a site which has only landing pages.

  3. yes, can be done but you might need to overide the db.php file

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.