WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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

I hope you can do it using your own custom php code. This post may help you doing it.

share|improve this answer
This is not a real answer. Please explain why this helps. If these links ever go away, the answer becomes completely benign. – Brian Fegter Sep 22 '12 at 13:47
Just edited to look more professional :) – Darshan Thanki Sep 22 '12 at 13:52
With answers like this, you can quote the actual article and post code snippets here while citing the article as the source. That way if the article goes away, your answer is still beneficial. +1 for the edit. – Brian Fegter Sep 22 '12 at 13:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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