Title: Retrieving specific post type from different wp database
Last modified: August 31, 2016

---

# Retrieving specific post type from different wp database

 *  [Format81](https://wordpress.org/support/users/format81/)
 * (@format81)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/retrieving-specific-post-type-from-different-wp-database/)
 * Hi all,
    I have 2 wp installation with 2 database on single server. I’d like 
   to query database1 from wp2 just for retrieving post marked as ‘post_type’=> ‘
   appuntamenti’.
 * How can I modify following code?
    `global $wp_query; $maxnum = $wp_query->found_posts;`
   is querying db2 instead of db1.
 *     ```
       <?php /*<a target="_blank" href="http://cblive.it/wp/wp-content/uploads/2014/05/codice_autoregolamentazione.pdf"><img src="http://cblive.it/wp/wp-content/uploads/2014/05/codiceBtn.png" /></a>
       */ ?><div id="appuntamenti_widget">
           <h3><a href="/notizie-molise/">Notizie dal Molise</a></h3>
           <div class="content">
               <?php
                       query_posts(array(
   
                           'post_type'=> 'appuntamenti',
                           'posts_per_page'=>10
                       ));
                   while(have_posts()) : the_post();
                   global $wp_query; $maxnum = $wp_query->found_posts;
                ?>
   
                <div id="featured-<?php the_ID();?>">
   
                   <h2 class="entry-title">
                       <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themejunkie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?> <?php the_post_thumbnail(featured-thumb); ?></a>
                   </h2>
               </div>
   
               <?php endwhile; wp_reset_query(); ?>
           </div>
       </div>
       ```
   
 * Any help is greatly appreciated.
    Thank you

The topic ‘Retrieving specific post type from different wp database’ is closed to
new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [db_tricks](https://wordpress.org/support/topic-tag/db_tricks/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Format81](https://wordpress.org/support/users/format81/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/retrieving-specific-post-type-from-different-wp-database/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
