Title: wp-includes/query.php | Developer.WordPress.org

---

# File: wp-includes/query.php

 * function[is_sitemap()](https://developer.wordpress.org/reference/functions/is_sitemap/)
 * Is the query for a sitemap?
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/is_sitemap/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_sitemap/#uses)
   | Source: [wp-includes/query.php:692](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L692-L701)
 * function[is_favicon()](https://developer.wordpress.org/reference/functions/is_favicon/)
 * Is the query for the favicon.ico file?
 * Used by [2 functions](https://developer.wordpress.org/reference/functions/is_favicon/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_favicon/#uses)
   | Source: [wp-includes/query.php:672](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L672-L681)
 * function[generate_postdata()](https://developer.wordpress.org/reference/functions/generate_postdata/)
 * Generates post data.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/generate_postdata/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/generate_postdata/#uses)
   | Source: [wp-includes/query.php:1269](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1269-L1277)
 * function[is_privacy_policy()](https://developer.wordpress.org/reference/functions/is_privacy_policy/)
 * Determines whether the query is for the Privacy Policy page.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/is_privacy_policy/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_privacy_policy/#uses)
   | Source: [wp-includes/query.php:529](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L529-L538)
 * hook[old_slug_redirect_post_id](https://developer.wordpress.org/reference/hooks/old_slug_redirect_post_id/)
 * Filters the old slug redirect post ID.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/old_slug_redirect_post_id/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/old_slug_redirect_post_id/#uses)
   | Source: [wp-includes/query.php:1113](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1113-L1113)
 * function[_find_post_by_old_slug()](https://developer.wordpress.org/reference/functions/_find_post_by_old_slug/)
 * Find the post ID for redirecting an old slug.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/_find_post_by_old_slug/#used-by)
   | Uses [6 functions](https://developer.wordpress.org/reference/functions/_find_post_by_old_slug/#uses)
   | Source: [wp-includes/query.php:1157](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1157-L1188)
 * function[_find_post_by_old_date()](https://developer.wordpress.org/reference/functions/_find_post_by_old_date/)
 * Find the post ID for redirecting an old date.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/_find_post_by_old_date/#used-by)
   | Uses [6 functions](https://developer.wordpress.org/reference/functions/_find_post_by_old_date/#uses)
   | Source: [wp-includes/query.php:1202](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1202-L1236)
 * hook[old_slug_redirect_url](https://developer.wordpress.org/reference/hooks/old_slug_redirect_url/)
 * Filters the old slug redirect URL.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/old_slug_redirect_url/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/old_slug_redirect_url/#uses)
   | Source: [wp-includes/query.php:1134](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1134-L1134)
 * function[is_embed()](https://developer.wordpress.org/reference/functions/is_embed/)
 * Is the query for an embedded post?
 * Used by [5 functions](https://developer.wordpress.org/reference/functions/is_embed/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_embed/#uses)
   | Source: [wp-includes/query.php:898](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L898-L907)
 * function[rewind_posts()](https://developer.wordpress.org/reference/functions/rewind_posts/)
 * Rewind the loop posts.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/rewind_posts/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/rewind_posts/#uses)
   | Source: [wp-includes/query.php:1001](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1001-L1009)
 * function[the_post()](https://developer.wordpress.org/reference/functions/the_post/)
 * Iterate the post index in the loop.
 * Used by [2 functions](https://developer.wordpress.org/reference/functions/the_post/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/the_post/#uses)
   | Source: [wp-includes/query.php:1018](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1018-L1026)
 * function[have_comments()](https://developer.wordpress.org/reference/functions/have_comments/)
 * Determines whether current WordPress query has comments to loop over.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/have_comments/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/have_comments/#uses)
   | Source: [wp-includes/query.php:1041](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1041-L1049)
 * function[the_comment()](https://developer.wordpress.org/reference/functions/the_comment/)
 * Iterate comment index in the comment loop.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/the_comment/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/the_comment/#uses)
   | Source: [wp-includes/query.php:1058](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1058-L1066)
 * function[is_preview()](https://developer.wordpress.org/reference/functions/is_preview/)
 * Determines whether the query is for a post or page preview.
 * Used by [3 functions](https://developer.wordpress.org/reference/functions/is_preview/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_preview/#uses)
   | Source: [wp-includes/query.php:632](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L632-L641)
 * function[wp_old_slug_redirect()](https://developer.wordpress.org/reference/functions/wp_old_slug_redirect/)
 * Redirect old slugs to the correct permalink.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/wp_old_slug_redirect/#used-by)
   | Uses [11 functions](https://developer.wordpress.org/reference/functions/wp_old_slug_redirect/#uses)
   | Source: [wp-includes/query.php:1075](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1075-L1143)
 * function[is_robots()](https://developer.wordpress.org/reference/functions/is_robots/)
 * Is the query for the robots.txt file?
 * Used by [2 functions](https://developer.wordpress.org/reference/functions/is_robots/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_robots/#uses)
   | Source: [wp-includes/query.php:652](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L652-L661)
 * function[setup_postdata()](https://developer.wordpress.org/reference/functions/setup_postdata/)
 * Set up global post data.
 * Used by [9 functions](https://developer.wordpress.org/reference/functions/setup_postdata/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/setup_postdata/#uses)
   | Source: [wp-includes/query.php:1249](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L1249-L1257)
 * function[is_search()](https://developer.wordpress.org/reference/functions/is_search/)
 * Determines whether the query is for a search.
 * Used by [7 functions](https://developer.wordpress.org/reference/functions/is_search/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_search/#uses)
   | Source: [wp-includes/query.php:716](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L716-L725)
 * function[is_single()](https://developer.wordpress.org/reference/functions/is_single/)
 * Determines whether the query is for an existing single post.
 * Used by [10 functions](https://developer.wordpress.org/reference/functions/is_single/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_single/#uses)
   | Source: [wp-includes/query.php:749](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L749-L758)
 * function[is_singular()](https://developer.wordpress.org/reference/functions/is_singular/)
 * Determines whether the query is for an existing single post of any post type (
   post, attachment, page, custom post types).
 * Used by [21 functions](https://developer.wordpress.org/reference/functions/is_singular/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_singular/#uses)
   | Source: [wp-includes/query.php:782](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L782-L791)
 * function[is_time()](https://developer.wordpress.org/reference/functions/is_time/)
 * Determines whether the query is for a specific time.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/is_time/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_time/#uses)
   | Source: [wp-includes/query.php:806](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L806-L815)
 * function[is_trackback()](https://developer.wordpress.org/reference/functions/is_trackback/)
 * Determines whether the query is for a trackback endpoint call.
 * Used by [2 functions](https://developer.wordpress.org/reference/functions/is_trackback/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_trackback/#uses)
   | Source: [wp-includes/query.php:830](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L830-L839)
 * function[is_year()](https://developer.wordpress.org/reference/functions/is_year/)
 * Determines whether the query is for an existing year archive.
 * Used by [3 functions](https://developer.wordpress.org/reference/functions/is_year/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_year/#uses)
   | Source: [wp-includes/query.php:854](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L854-L863)
 * function[is_404()](https://developer.wordpress.org/reference/functions/is_404/)
 * Determines whether the query has resulted in a 404 (returns no results).
 * Used by [11 functions](https://developer.wordpress.org/reference/functions/is_404/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_404/#uses)
   | Source: [wp-includes/query.php:878](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L878-L887)
 * function[is_main_query()](https://developer.wordpress.org/reference/functions/is_main_query/)
 * Determines whether the query is the main query.
 * Used by [2 functions](https://developer.wordpress.org/reference/functions/is_main_query/#used-by)
   | Uses [4 functions](https://developer.wordpress.org/reference/functions/is_main_query/#uses)
   | Source: [wp-includes/query.php:922](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L922-L946)
 * function[have_posts()](https://developer.wordpress.org/reference/functions/have_posts/)
 * Determines whether current WordPress query has posts to loop over.
 * Used by [4 functions](https://developer.wordpress.org/reference/functions/have_posts/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/have_posts/#uses)
   | Source: [wp-includes/query.php:961](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L961-L969)
 * function[in_the_loop()](https://developer.wordpress.org/reference/functions/in_the_loop/)
 * Determines whether the caller is in the Loop.
 * Used by [3 functions](https://developer.wordpress.org/reference/functions/in_the_loop/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/functions/in_the_loop/#uses)
   | Source: [wp-includes/query.php:984](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L984-L992)
 * function[is_home()](https://developer.wordpress.org/reference/functions/is_home/)
 * Determines whether the query is for the blog homepage.
 * Used by [7 functions](https://developer.wordpress.org/reference/functions/is_home/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_home/#uses)
   | Source: [wp-includes/query.php:499](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L499-L508)
 * function[is_month()](https://developer.wordpress.org/reference/functions/is_month/)
 * Determines whether the query is for an existing month archive.
 * Used by [3 functions](https://developer.wordpress.org/reference/functions/is_month/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_month/#uses)
   | Source: [wp-includes/query.php:553](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L553-L562)
 * function[is_page()](https://developer.wordpress.org/reference/functions/is_page/)
 * Determines whether the query is for an existing single page.
 * Used by [5 functions](https://developer.wordpress.org/reference/functions/is_page/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/is_page/#uses)
   | Source: [wp-includes/query.php:584](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L584-L593)

1 [2](https://developer.wordpress.org/reference/file/wp-includes/query.php/page/2/?output_format=md)

 [Next Page](https://developer.wordpress.org/reference/file/wp-includes/query.php/page/2/?output_format=md)