Unable To Get Published posts using query_posts

First off, you probably shouldn’t be using query_posts, which modifies WordPress’ main loop and is unsuited for pretty much any purpose (read When should you use WP_Query vs query_posts() vs get_posts()? for more info). There are numerous reasons why query_posts wouldn’t work as expected in this case.

WordPress has two proper approaches to fetching posts: the WP_Query object and the get_posts function. They work very similarly, with get_posts using WP_Query internally. However, as one would expect, WP_Query allows for more control.

For your case, get_posts should work (as there is no further flaw in the code you posted).

tech