WordPress – How do I output the last query used by query_posts?

I am attempting to grab all posts for a specific day (ie: today), however for some reason it is only returning the one.

$wp_posts = query_posts(array(
            'cat' => 4,
            'post_status' => array('any', 'publish', 'future', 'inherit', 'revision', 'pending'), 
            'year' => '2011',
            'monthnum' => '10',
            'day' => '25',                  
            'order_by' => 'post_date',
            'order' => 'ASC'
            ));

This should post all the posts for today under a category, but whatever reason it only outputs 1 post and I do not know why.

Read More

At first I thought it might be a permalink issue, but I removed the permalinks and its still only returning the one post?

On my localhost the code works fine and outputs all the content required for a specific day.

Additionally, I have checked the database and all the posts for the day are there and appear to be in schedule or posted status.

So there is no reason why the query_posts should be returning just 1 item.

I want to output the last query used by query_posts to investigate what is causing the problem.

How do I verbosely output the last query as used by query_posts?

Thanks.

Edit.

I will accept an answer that converts the above to a verbose SQL query which I can run to see what is going on

Related posts

Leave a Reply

3 comments

  1. I figured out what the problem was.

    On http://codex.wordpress.org/Custom_Queries it seems to imply that a post_limit has a default.

    I successfully outputted the entire object using a blank page and combining WP_Query with my posts array posted above.

    In it I found a response with a limit of 0,1

    I’m not sure why it put this in, or why it only affected my live site.

    But this seems to correspond with the limit I noted in the Custom_Queries code.

    In my file, I put this:

    add_filter('post_limits', 'gloss_limits' );
    
    function gloss_limits( )
    {
         return "";
    }
    

    As per the Custom_Queries URL.

    And it removed the limit and I finally got to output everything from that day.

    I’ve accepted Jorbin’s answer as the ‘Save queries for analysis’ is a specific answer to my query.