• Hello,

    I am trying to make a xml feed that will show posts based on GET data in URL (aka get.php?FromDate&ToDate). I have the script and all working but the WP Query queries all messages (posts_per_page is set and shown in query_vars) and they are not sorted by date.

    For FromDate=2015-03-03-000000&ToDate=2015-03-04-235959
    it shows following
    query vars

    Array
    (
        [posts_per_page] => 3
        [orderby] => date
        [order] => DESC
        [date_query] => Array
            (
                [after] => Array
                    (
                        [year] => 2015
                        [month] => 03
                        [day] => 03
                    )
    
                [before] => Array
                    (
                        [year] => 2015
                        [month] => 03
                        [day] => 04
                    )
    
                [inclusive] => 1
            )
    
        [error] =>
        [m] =>
        [p] => 0
        [post_parent] =>
        [subpost] =>
        [subpost_id] =>
        [attachment] =>
        [attachment_id] => 0
        [name] =>
        [static] =>
        [pagename] =>
        [page_id] => 0
        [second] =>
        [minute] =>
        [hour] =>
        [day] => 0
        [monthnum] => 0
        [year] => 0
        [w] => 0
        [category_name] =>
        [tag] =>
        [cat] =>
        [tag_id] =>
        [author] =>
        [author_name] =>
        [feed] =>
        [tb] =>
        [paged] => 0
        [comments_popup] =>
        [meta_key] =>
        [meta_value] =>
        [preview] =>
        [s] =>
        [sentence] =>
        [fields] =>
        [menu_order] =>
        [category__in] => Array
            (
            )
    
        [category__not_in] => Array
            (
            )
    
        [category__and] => Array
            (
            )
    
        [post__in] => Array
            (
            )
    
        [post__not_in] => Array
            (
            )
    
        [tag__in] => Array
            (
            )
    
        [tag__not_in] => Array
            (
            )
    
        [tag__and] => Array
            (
            )
    
        [tag_slug__in] => Array
            (
            )
    
        [tag_slug__and] => Array
            (
            )
    
        [post_parent__in] => Array
            (
            )
    
        [post_parent__not_in] => Array
            (
            )
    
        [author__in] => Array
            (
            )
    
        [author__not_in] => Array
            (
            )
    
        [ignore_sticky_posts] =>
        [suppress_filters] =>
        [cache_results] => 1
        [update_post_term_cache] => 1
        [update_post_meta_cache] => 1
        [post_type] =>
        [nopaging] =>
        [comments_per_page] => 50
        [no_found_rows] =>
    )

    And the full code is at:
    https://pastebin.com/ngy4GnNC

    I also thought it might be some conflicting plugin or it would cause my theme but I don’t have anything that might cause this in my functions.php file.

  • The topic ‘WP Query ignores args although it uses them’ is closed to new replies.