Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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

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

Your Answer

 
discard

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.