Query a single private page with query_posts or wp_query
I need to query a single page with query_posts (changing the main loop).
I need to query its content in a single page, but I don’t want the page to be url queryable. So I created it as private.
I modify the query this way:
$args = array( 'pagename' => 'here_the_page_slug', 'posts_per_page' => 1, 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ) // or just 'private' ); query_posts( $args );
But does’t work. I also tried the same query with a secondary loop using wp_query with no success.
The only way I could get it was using get_page_by_path, but I need to modify the loop.
Thanks for your time in advance
- The topic ‘Query a single private page with query_posts or wp_query’ is closed to new replies.