title: i get a empty result in select2 with php “select(sql)”
body: <p>I want to search with select 2 in page wordpress and i want to get in result only private page, I get a number of li correct "14 li" and this what i have in my db but li foreach is empty why?</p>
  
  <pre><code>$post_id = $wpdb-&gt;get_results("SELECT `ID`,`post_title` FROM $wpdb-&gt;posts WHERE `post_type` = 'page' and `post_status` = 'private'");
  
  ?&gt;
  &lt;div class="form-group"&gt;
          &lt;label class="col-md-3 control-label" for="service"&gt;&lt;?php echo $lang['department']; ?&gt; *&lt;/label&gt;
          &lt;div class="col-md-8"&gt;
            &lt;select name="services[]" id="service" class="form-control select2-multiple" multiple&gt;
                &lt;?php if ( !empty( $post_id ) ) {
                          foreach ( $post_id as $r ) {              
                  ?&gt;
                &lt;option value="&lt;?php echo $post_id['ID']?&gt;"&gt;&lt;?php $post_id['post_title']?&gt;&lt;/option&gt;
               &lt;?php
                      }
                      }               
               ?&gt;
            &lt;/select&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;script&gt;
              jQuery(document).ready(function() {
                      jQuery('#service').select2();
              });
      &lt;/script&gt;
  </code></pre>