• I have a “what’s new” section of a home page that is supposed to display up to 3 of the latest “sticky” posts.

    Yesterday it started only showing two even when the code hadn’t changed.

    I traced it to the fact that there was a post originally published and marked sticky but then send to the Trash. Emptying the trash fixed the problem and the latest three sticky posts are showing again.

    My question is, how do I alter query_post arguments to ensure that WordPress isn’t trying to display sticky posts that happen to be sitting in the Trash?

    Here is my query_post line. I tried to do what I thought was obvious and add ‘post_status’ != ‘trash’ to the argument list, but it had no effect:

    query_posts(array(‘post_status’ => ‘publish’, ‘post_status’ != ‘trash’, ‘category_name’ => ‘news-releases’, ‘post__in’ => $sticky, ‘caller_get_posts’ => 1 ));

    Thanks.

  • The topic ‘How do I exclude trashed sticky posts from query_posts?’ is closed to new replies.