Title: query_posts returns blank
Last modified: August 19, 2016

---

# query_posts returns blank

 *  [oliverm](https://wordpress.org/support/users/oliverm/)
 * (@oliverm)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-returns-blank/)
 * Hi
 * I have a problem with query_posts returning an empty string when trying to return
   a specific page.
 * In my sidebar I have this;
 * `<div id=menu>`
    `<ul><?php query_posts('pageid=6'); ?></ul>` `<ul><a href="<?
   php query_posts('pagename=services'); ?>">Services</a></ul>`
 * (you can see I’ve tried it embedded within an A tag and without).
 * In my html code I just get this;
 * `<div id=menu>`
    `<ul></ul>` `<ul><a href="">Services</a></ul>`
 * This applies to any query_posts query that I try to run in my sidebar.php. However,
   other queries, like a wp_list_pages query that I also run in my sidebar, run 
   fine and return valid data.
 * I’ve checked that pageid 6 exists and that there is a page with a slug of ‘services’.
 * Can anyone think of why this might be ?
 * Olly

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-returns-blank/#post-1050517)
 * Hi
 * You are misunderstanding what query_posts does. By itself it produces no output.
   It simply sets up query parameters that are then processed by running a WordPress
   loop. You are not running a loop so you see no output.
 * You can just use wp_list_pages with a parameter that limits it to one page:
 *     ```
       <div id=menu>
       <ul>
         <?php wp_list_pages('include=6&amp;title_li='); ?>
       </ul>
       ```
   
 *  Thread Starter [oliverm](https://wordpress.org/support/users/oliverm/)
 * (@oliverm)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-returns-blank/#post-1050518)
 * AHHHH!
 * Thanks very much.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘query_posts returns blank’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [oliverm](https://wordpress.org/support/users/oliverm/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-returns-blank/#post-1050518)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
