Title: query_posts with different database
Last modified: August 19, 2016

---

# query_posts with different database

 *  [mamulea](https://wordpress.org/support/users/mamulea/)
 * (@mamulea)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/query_posts-with-different-database/)
 * Hello and thanks for reading this. I have two blogs installed using the same 
   database, one with $table_prefix = ‘wp1_’ and the other with $table_prefix = ‘
   wp2_’. What I want to do is displaying posts from the second blog (wp2) on the
   main page of the first blog (wp1), but when I use query_posts it always takes
   posts from the current database (wp1). How can I use query_posts to get posts
   from other table in database? 10x.

Viewing 1 replies (of 1 total)

 *  Thread Starter [mamulea](https://wordpress.org/support/users/mamulea/)
 * (@mamulea)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/query_posts-with-different-database/#post-785580)
 * Ok, I’ll put it some other way. How can I modify The Loop so that it reads posts
   from other table in the database than wp_posts?

Viewing 1 replies (of 1 total)

The topic ‘query_posts with different database’ is closed to new replies.

## Tags

 * [Multiple Blogs](https://wordpress.org/support/topic-tag/multiple-blogs/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [mamulea](https://wordpress.org/support/users/mamulea/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/query_posts-with-different-database/#post-785580)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
