It’s empty because you’re looking at it before it has a chance to be populated.
The top of functions.php is too early. You should be doing it in a ‘template_redirect’ action.
Or, better yet, use the Debug Bar plugin.
Related Posts:
- Add category and user name to recently updated post list
- Creating array to compare custom field values
- WordPress Query Default Order if Meta Values Same?
- Comments orderby comment date not working
- Switched from query_posts to wp_query, pagination no longer working
- Adding page subdirectory dynamically, as like buddypress does
- Divide WP_Query posts by date & post type
- How to return value from sql and display it
- orderby in WP_query doesn’t works
- Unable to pass variable
- Letting users sort posts
- qTranslate get content by language using wp_query
- Extract video content from post to display on front page
- What is wrong with this pagination code?
- WP Query get posts by specific author IDs if one of several logged in authors
- Sort by name – second wp_query
- Retrieve posts in custom post type and specific taxonomies
- How to query post ids liked by the Author
- Sort Posts with custom meta key by default which is currently set as optional
- wp_query pagination links producing 404
- Meta_query weird behaviour
- Why is WP_Query’s meta_query not filtering results?
- Including ‘cat’ => $cat breaks meta_query
- Pagination With Custom WP Query not functioning
- wp_query conditionally get posts
- How return normal search result using wp_ajax action for wordpress
- meta_query compare not doing what I want it to do
- Manipulating a query
- Getting Year & Date inside wpdb [duplicate]
- SQL returned by Wp_Query has wp_posts.ID = -1
- Converting an existing query_posts to WP_Query
- Can’t get pagination to work with this WP_Query loop
- loop through custom post types with meta data
- Passing additional variables to a query
- WordPress Query showing multiple titles
- Query Posts by date range with fixed beginning and end
- Looking for a way to exclude frontpage and nav menu from query filter
- custom query to get posts
- Pagination in custom loop [duplicate]
- query by meta value then date and not empty meta value
- Issue with sorting by post date and custom post type
- get contents and permalink from a specified page
- confirm my booking with phone number
- What query to append the 10 next posts?
- Posts2Posts, wp_query and orderby issue
- pre_get_posts redirecting
- Why isn’t my Meta_Query running?
- Dynamically name array in WordPress loop – add/get values
- Dynamically create array from page title
- Ordering Custom WP_Query loop by meta key value with pagination
- Display First posts without the default featured image
- Custom query to show posts
- Read more redirection problem
- New WordPress WP Query using posts from certain categories
- Hierarchical List Pages as a table
- WP_Query with several meta_query-statements and order by meta_value
- Displaying content to search engines but via navigation only for registered users.
- Pull Instagram images into an existing loop?
- When importing a database any page with a wp_query in doesn’t work
- Multiple homepage layouts as selected by user from theme options
- Custom search: Search posts but display parent page in results
- Query specific number of posts for each post type in specific order
- Modify query after meta value
- Avoiding page loop
- Custom post types loop on a page template
- Query Users by post count, last 30 days and display each users post count according to post type
- problem in query_vars parameters
- Limit Tags display and ad Drop Down Menu
- Loop being strainge
- Using Query In Post Type Archives
- Is it possible to use WP Query to orderby custom meta value and custom taxonomy?
- Do not show a custom post if it belongs to a certain custom taxonomy
- Multiple loop for “featured” items returns wrong posts
- $query conflicting with other queries in the same page
- Why won’t my paged wp_query work? [duplicate]
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- wp query problem
- Query posts by custom fields
- Get WP_Query query after execution?
- WP_Query breaks pagination
- WP_Query search by multiple meta key and distance
- Showing posts from 4 categories along with all latest posts
- How ‘secure’ are loops?
- Pagination in custom query not working [duplicate]
- Order by meta values
- What triggers these wordpress queries on my homepage?
- Providing a function to override the default query
- Pagination doesn’t work for home page custom post type query
- How to display comments list by order when clicking on newest or oldest link?
- Get the number of rows from $wpdb->get_results not working
- How to specify a certain amount of images queried, not all?
- Loop issues when creating custom query for media uploader
- Query multiple taxonomies with pagination
- WP_Query do not include posts with a certain value in a custom field –
- shortcode using multiple WP_Query’s with multiple category names not fully functional
- Pagination in WP query with transient API
- wp_pagenavi on WP_Query using customfields
- Different sql queries count indicator on the main page [closed]
- paginate_links() on page (shortcode output)
- paginate_links() with Custom Taxonomy