I know that wp_insert_post() insert posts into wp_posts table. I want to change that to insert posts into lets say wp_posts2. Can I do that?

I need to do this because I don't want to mess data from 2 databases and I barely use them individually.

1 Answer 1


This is theoretically possible. While there is no explicit way to do this in post insert/update process, all queries go through query filter before being run on database.

Practically this is a no go. The level of complexity in WP's handling of post querying is incomprehensible and full of edge cases. There is no easy telling how much would break over seemingly simple tweak of having more than one posts table. There are solutions and people doing this, but this is always driven by heavy operation requirements (elaborate content management needs, database sharding for performance and so on).

In a nutshell as question posed — leave it alone before you mess up much more than you want to avoid there. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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