3

I want to fetch some post from another wordpress site which is hosted in the same server. How can I fetch those post?

Is multiple database connection is possible in wordpress?

3

It is possible but you must manually create a new instance of the wpdb class with right settings for your other database.

Quote from the wpdb Codex page:

The $wpdb object can talk to any number of tables, but only one database: the WordPress database. In the rare case you need to connect to another database, you will have to instantiate your own object from the wpdb class with the appropriate connection details. For extremely complicated setups with many databases, consider using hyperdb instead.

  • Thanks Hamid for your reply. I have create a new instance of global wpdb class and its work fine. – soumendu Sep 24 '12 at 11:46
  • It's not Hamid, my name is Hamed. And you are welcome. You might as well check this answer as the correct answer. – Hamed Momeni Sep 25 '12 at 16:42
0

You can use HyperDB: https://wordpress.org/plugins/hyperdb/ It allows multiple databases, also read/write replicas or master / slave.

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.