title: WordPress Get Page By ID returns strange results
body: <p>I have a CMS setup for a client with three meta boxes for related content. All the client has to do is eneter a page slug (one in each) and the site will return the three related products.</p>
  
  <p>Everything was working fine until my client accidentally misspelled one of the slugs. Instead of returning nothing for this spot, WordPress returns about 6 random items.</p>
  
  <p>IN FUNCTIONS.PHP:</p>
  
  <pre><code>function get_ID_by_page_name($page_name) {
  global $wpdb;
  $page_name_id = $wpdb-&gt;get_var("SELECT ID FROM $wpdb-&gt;posts WHERE post_name = '".$page_name."' AND post_type = 'page'");
  return $page_name_id;
  </code></pre>
  
  <p>}</p>
  
  <p>IN THE TEMPLATE FILE:</p>
  
  <pre><code>$goesWith = get_post_meta($post-&gt;ID, 'goes_with', true);
  
  if (($goesWith) or ($goesWith2) or ($goesWith3)) {
  
              echo "&lt;div class='goes-with'&gt;";
  
              echo  "&lt;h2&gt;Goes Great With:&lt;/h2&gt;";                      
  
              // OPTION ONE
  
                  $pageID = get_ID_by_page_name($goesWith);
  
                      if ($goesWith) { 
  
                          $args = array(
                              'post_type'      =&gt; 'page',
                              'page_id'     =&gt; $pageID,
                              'post_status' =&gt; 'publish'
                          );
                          query_posts( $args );
  
                          while(have_posts()) {
  
                              the_post(); // vital                                                        
  
                              echo "&lt;div class='post-product'&gt;";
                              echo "&lt;a href=";
                              the_permalink();
                              echo "&gt;";
                              thumbPath(140, 140);
                              echo "&lt;/a&gt;&lt;a href=";
                              the_permalink();
                              echo "&gt;&lt;p&gt;";
                              the_title();
                              echo "&lt;/p&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--end post-product--&gt;";
  
                         }
  
  
  
                      }
  
                      else {
  
                          echo "";
  
                      } 
  
  
              wp_reset_query();  
  </code></pre>