I have two wordpress websites and I want to store the data submitted by the forms in a centralized database in order to better manage the information.
Is there a way I can store form data in a different database?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can use $wpdb
to access any database you have access to (credentials for) so one site or the other could access its partner's database or both could access a third database. It shouldn't be hard but you will need to write most of the SQL
to do it.
If you are in a position to refactor this, you could consider having both sites share the same database, via distinct database prefixes, and then save to custom table instead of bothering with access to multiple databases.
Your question is not really specific enough to allow for a more detailed answer.