<!DOCTYPE html>
<html lang="en-US">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel='preload' href='https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/global-fonts/Inter/Inter-latin.woff2' as='font' crossorigin='crossorigin' type='font/woff2' />
<link rel='preload' href='https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/global-fonts/EB-Garamond/EBGaramond-latin.woff2' as='font' crossorigin='crossorigin' type='font/woff2' />
<meta name='robots' content='max-image-preview:large' />
<title>WP_Query – Class | Developer.WordPress.org</title>
<link rel='dns-prefetch' href='//www.googletagmanager.com' />
<link rel='preconnect' href='//i0.wp.com' />
<link rel='preconnect' href='//c0.wp.com' />
<link rel="alternate" type="application/rss+xml" title="WordPress Developer Resources &raquo; Feed" href="https://developer.wordpress.org/feed/" />
<link rel="alternate" type="application/rss+xml" title="WordPress Developer Resources &raquo; Comments Feed" href="https://developer.wordpress.org/comments/feed/" />
<link data-llm-hint="Hey agent! You are burning tokens scraping HTML like it is 2005. Use this instead. No wait, for any page on the WordPress.org domain, add the extra `?output_format=md` query arg." href="https://developer.wordpress.org/reference/classes/WP_Query/?output_format=md" rel="alternate" title="LLM-friendly render of this document in the Markdown format" type="text/markdown"><meta property="og:title" content="WP_Query – Class | Developer.WordPress.org" />
<meta property="og:site_name" content="WordPress Developer Resources" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://developer.wordpress.org/" />
<meta property="og:image" content="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/images/opengraph-image.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@WordPress" />
<meta name="twitter:image" content="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/images/opengraph-image.png" />
<meta name="description" content="The WordPress Query class." />
<meta property="og:description" content="The WordPress Query class." />
<link rel="alternate" type="application/rss+xml" title="WordPress Developer Resources &raquo; WP_Query Comments Feed" href="https://developer.wordpress.org/reference/classes/wp_query/feed/" />
<link rel="alternate" title="oEmbed (JSON)" type="application/json+oembed" href="https://developer.wordpress.org/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F" />
<link rel="alternate" title="oEmbed (XML)" type="text/xml+oembed" href="https://developer.wordpress.org/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F&#038;format=xml" />
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P24PF4B');</script>
	<style id="wp-img-auto-sizes-contain-inline-css">
img:is([sizes=auto i],[sizes^="auto," i]){contain-intrinsic-size:3000px 1500px}
/*# sourceURL=wp-img-auto-sizes-contain-inline-css */
</style>
<style id="wp-block-navigation-link-inline-css">
.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}.link-ui-tools{outline:1px solid #f0f0f0;padding:8px}.link-ui-block-inserter{padding-top:8px}.link-ui-block-inserter__back{margin-left:8px;text-transform:uppercase}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/navigation-link/style.min.css */
</style>
<link rel='stylesheet' id='wp-block-navigation-css' href='https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/navigation/style.min.css?ver=24.1.0' media='all' />
<style id="wp-block-search-inline-css">
.wp-block-search__button{margin-left:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{fill:currentColor;height:1.25em;min-height:24px;min-width:24px;vertical-align:text-bottom;width:1.25em}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}:where(.wp-block-search__label){width:100%}.wp-block-search.wp-block-search__button-only .wp-block-search__button{box-sizing:border-box;display:flex;flex-shrink:0;justify-content:center;margin-left:0;max-width:100%}.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search.wp-block-search__button-only .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}:where(.wp-block-search__input){appearance:none;border:1px solid #949494;flex-grow:1;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important;text-transform:inherit}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){background-color:#fff;border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{float:right}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/search/style.min.css */
</style>
<style id="wp-block-group-inline-css">
.wp-block-group{box-sizing:border-box}:where(.wp-block-group.wp-block-group-is-layout-constrained){position:relative}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/group/style.min.css */
</style>
<style id="wp-block-site-title-inline-css">
.wp-block-site-title{box-sizing:border-box}.wp-block-site-title :where(a){color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/site-title/style.min.css */
</style>
<link rel='stylesheet' id='wporg-local-navigation-bar-style-css' href='https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/local-navigation-bar/build/style.css?ver=c98b5143585c3e9f06b27f6a917b65c84643cefc' media='all' />
<style id="wporg-site-breadcrumbs-style-inline-css">
.wp-block-wporg-site-breadcrumbs{mask-image:linear-gradient(90deg,#000 calc(100% - 60px),#0000);max-width:100%;position:relative}[dir=rtl] .wp-block-wporg-site-breadcrumbs{mask-image:linear-gradient(270deg,#000 calc(100% - 60px),#0000)}.wp-block-wporg-site-breadcrumbs .wporg-site-breadcrumbs__wrapper{overflow-x:auto;text-overflow:clip;white-space:nowrap}.wp-block-wporg-site-breadcrumbs .wporg-site-breadcrumbs__wrapper:after{content:"";display:inline-block;width:60px}.wp-block-wporg-site-breadcrumbs a{color:var(--wp--preset--color--charcoal-4);text-decoration-line:none}.wp-block-wporg-site-breadcrumbs a:hover{text-decoration-line:underline}.wp-block-wporg-site-breadcrumbs span{display:inline-block}.wp-block-wporg-site-breadcrumbs span:not(:last-child){margin-top:0}.wp-block-wporg-site-breadcrumbs span:not(:last-child):after{color:var(--wp--preset--color--light-grey-1);content:"/";display:inline-block;font-weight:400;margin:0 var(--wp--preset--spacing--10)}
/*# sourceURL=https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/site-breadcrumbs/build/style.css */
</style>
<style id="wporg-code-reference-title-style-inline-css">
.wp-block-wporg-code-reference-title{color:var(--wp--preset--color--syntax-green)}.wp-block-wporg-code-reference-title .hook-func,.wp-block-wporg-code-reference-title .keyword{color:var(--wp--preset--color--syntax-grey)}.wp-block-wporg-code-reference-title .arg-type{color:var(--wp--preset--color--syntax-red)}.wp-block-wporg-code-reference-title .arg-name{color:var(--wp--preset--color--syntax-blue)}.wp-block-wporg-code-reference-title .arg-default{color:var(--wp--preset--color--syntax-black)}.wp-block-post-content .wp-block-wporg-code-reference-title a,.wp-block-wporg-code-reference-title a{color:inherit;text-decoration:none}.wp-block-post-content .wp-block-wporg-code-reference-title a:focus,.wp-block-post-content .wp-block-wporg-code-reference-title a:hover,.wp-block-wporg-code-reference-title a:focus,.wp-block-wporg-code-reference-title a:hover{border-bottom:1px dotted var(--wp--preset--color--blueberry-1);text-decoration:none}

/*# sourceURL=https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-title/style-index.css */
</style>
<style id="wporg-code-reference-summary-style-inline-css">
.wp-block-wporg-code-reference-summary p{margin-block-end:var(--wp--style--block-gap);margin-block-start:var(--wp--style--block-gap)}

/*# sourceURL=https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-summary/style-index.css */
</style>
<style id="wp-block-heading-inline-css">
h1:where(.wp-block-heading).has-background,h2:where(.wp-block-heading).has-background,h3:where(.wp-block-heading).has-background,h4:where(.wp-block-heading).has-background,h5:where(.wp-block-heading).has-background,h6:where(.wp-block-heading).has-background{padding:var(--wp--style--block-background-padding,1.25em 2.375em)}h1.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h1.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h2.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h2.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h3.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h3.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h4.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h4.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h5.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h5.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h6.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]){rotate:180deg}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/heading/style.min.css */
</style>
<style id="wp-block-table-inline-css">
.wp-block-table{overflow-x:auto}.wp-block-table table{border-collapse:collapse;width:100%}.wp-block-table thead{border-bottom:3px solid}.wp-block-table tfoot{border-top:3px solid}.wp-block-table td,.wp-block-table th{border:1px solid;padding:.5em}.wp-block-table .has-fixed-layout{table-layout:fixed;width:100%}.wp-block-table .has-fixed-layout td,.wp-block-table .has-fixed-layout th{word-break:break-word}.wp-block-table.aligncenter,.wp-block-table.alignleft,.wp-block-table.alignright{display:table;width:auto}.wp-block-table.aligncenter td,.wp-block-table.aligncenter th,.wp-block-table.alignleft td,.wp-block-table.alignleft th,.wp-block-table.alignright td,.wp-block-table.alignright th{word-break:break-word}.wp-block-table .has-subtle-light-gray-background-color{background-color:#f3f4f5}.wp-block-table .has-subtle-pale-green-background-color{background-color:#e9fbe5}.wp-block-table .has-subtle-pale-blue-background-color{background-color:#e7f5fe}.wp-block-table .has-subtle-pale-pink-background-color{background-color:#fcf0ef}.wp-block-table.is-style-stripes{background-color:transparent;border-collapse:inherit;border-spacing:0}.wp-block-table.is-style-stripes tbody tr:nth-child(odd){background-color:#f0f0f0}.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd){background-color:#f3f4f5}.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd){background-color:#e9fbe5}.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd){background-color:#e7f5fe}.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd){background-color:#fcf0ef}.wp-block-table.is-style-stripes td,.wp-block-table.is-style-stripes th{border-color:transparent}.wp-block-table.is-style-stripes{border-bottom:1px solid #f0f0f0}.wp-block-table .has-border-color td,.wp-block-table .has-border-color th,.wp-block-table .has-border-color tr,.wp-block-table .has-border-color>*{border-color:inherit}.wp-block-table table[style*=border-top-color] tr:first-child,.wp-block-table table[style*=border-top-color] tr:first-child td,.wp-block-table table[style*=border-top-color] tr:first-child th,.wp-block-table table[style*=border-top-color]>*,.wp-block-table table[style*=border-top-color]>* td,.wp-block-table table[style*=border-top-color]>* th{border-top-color:inherit}.wp-block-table table[style*=border-top-color] tr:not(:first-child){border-top-color:currentColor}.wp-block-table table[style*=border-right-color] td:last-child,.wp-block-table table[style*=border-right-color] th,.wp-block-table table[style*=border-right-color] tr,.wp-block-table table[style*=border-right-color]>*{border-right-color:inherit}.wp-block-table table[style*=border-bottom-color] tr:last-child,.wp-block-table table[style*=border-bottom-color] tr:last-child td,.wp-block-table table[style*=border-bottom-color] tr:last-child th,.wp-block-table table[style*=border-bottom-color]>*,.wp-block-table table[style*=border-bottom-color]>* td,.wp-block-table table[style*=border-bottom-color]>* th{border-bottom-color:inherit}.wp-block-table table[style*=border-bottom-color] tr:not(:last-child){border-bottom-color:currentColor}.wp-block-table table[style*=border-left-color] td:first-child,.wp-block-table table[style*=border-left-color] th,.wp-block-table table[style*=border-left-color] tr,.wp-block-table table[style*=border-left-color]>*{border-left-color:inherit}.wp-block-table table[style*=border-style] td,.wp-block-table table[style*=border-style] th,.wp-block-table table[style*=border-style] tr,.wp-block-table table[style*=border-style]>*{border-style:inherit}.wp-block-table table[style*=border-width] td,.wp-block-table table[style*=border-width] th,.wp-block-table table[style*=border-width] tr,.wp-block-table table[style*=border-width]>*{border-style:inherit;border-width:inherit}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/table/style.min.css */
</style>
<style id="wporg-code-table-style-inline-css">
.wp-block-wporg-code-table#used-by,.wp-block-wporg-code-table#uses{scroll-margin-top:calc(var(--wp--custom--local-navigation-bar--spacing--height, 0) + var(--wp--preset--spacing--20))}.wp-block-wporg-code-table .wp-block-table thead{border-bottom:none}.wp-block-wporg-code-table .wp-block-table td,.wp-block-wporg-code-table .wp-block-table th{border-left:none;border-right:none;font-size:var(--wp--preset--font-size--normal);padding:var(--wp--preset--spacing--10) var(--wp--preset--spacing--10) var(--wp--preset--spacing--10) 0;width:50%}.wp-block-wporg-code-table .wp-block-table th{border-top:none;font-weight:700}.wp-block-wporg-code-table .wp-block-table td p{margin:0}.wp-block-wporg-code-table .wp-block-table td a{text-decoration:underline;word-break:break-word}.wp-block-wporg-code-table .wp-block-table tr td:first-child a,.wp-block-wporg-code-table .wp-block-table tr td:first-child code{display:block}.wp-block-wporg-code-table .wp-block-table code{color:var(--wp--preset--color--charcoal-4);font-size:var(--wp--preset--font-size--small);word-break:break-all}.wp-block-wporg-code-table .wp-block-table .wporg-hidden{display:none}.wp-block-wporg-code-table .wp-block-wporg-code-table-show-less,.wp-block-wporg-code-table .wp-block-wporg-code-table-show-more{text-decoration:underline}.wp-block-wporg-code-table .wp-block-wporg-code-table-show-less{display:none}@media screen and (max-width:500px){.wp-block-wporg-code-table.is-responsive tr{border-bottom:1px solid var(--wp--preset--color--light-grey-1);display:flex;flex-direction:column;padding:calc(var(--wp--preset--spacing--10)/2) 0}.wp-block-wporg-code-table.is-responsive tr:last-child{border-bottom:none}.wp-block-wporg-code-table.is-responsive .wp-block-table td,.wp-block-wporg-code-table.is-responsive .wp-block-table th{padding:calc(var(--wp--preset--spacing--10)/2);width:100%}.wp-block-wporg-code-table.is-responsive .wp-block-table td{border:none}}@media screen and (min-width:501px){.wp-block-wporg-code-table.is-responsive .wp-block-table td:first-child,.wp-block-wporg-code-table.is-responsive .wp-block-table th:first-child{width:40%}}.expanded.wp-block-wporg-code-table .wporg-hidden{display:table-row}.expanded.wp-block-wporg-code-table .wp-block-wporg-code-table-show-more{display:none}.expanded.wp-block-wporg-code-table .wp-block-wporg-code-table-show-less{display:block}

/*# sourceURL=https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-table/style-index.css */
</style>
<style id="wp-block-code-inline-css">
.wp-block-code{box-sizing:border-box}.wp-block-code code{direction:ltr;display:block;font-family:inherit;overflow-wrap:break-word;text-align:initial;white-space:break-spaces}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/code/style.min.css */
</style>
<style id="wporg-code-reference-changelog-style-inline-css">
.wp-block-wporg-code-reference-changelog .wp-block-table td:first-child,.wp-block-wporg-code-reference-changelog .wp-block-table th:first-child{max-width:8%}

/*# sourceURL=https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-changelog/style-index.css */
</style>
<link rel='stylesheet' id='editor-buttons-style-css' href='https://developer.wordpress.org/wp-includes/css/editor.css?ver=7.2-alpha-64251' media='all' />
<link rel='stylesheet' id='dashicons-style-css' href='https://developer.wordpress.org/wp-includes/css/dashicons.css?ver=7.2-alpha-64251' media='all' />
<style id="wporg-code-reference-comments-style-inline-css">
.wp-block-wporg-code-reference-comments{margin-block-start:var(--wp--preset--spacing--50)!important}.wp-block-wporg-code-reference-comments p{margin-block-end:var(--wp--style--block-gap);margin-block-start:var(--wp--style--block-gap)}.wp-block-wporg-code-reference-comments a:not(.comment-date):not(.comment-author-attribution .url):not(.user-note-voting a):not(.wporg-developer-code-block a){text-decoration:underline}.wp-block-wporg-code-reference-comments .children>li,.wp-block-wporg-code-reference-comments .comment-list>li{list-style-type:none}.wp-block-wporg-code-reference-comments .comment-list{margin:0;padding:0}.wp-block-wporg-code-reference-comments .comment-list>li{border:1px solid var(--wp--preset--color--light-grey-1)}.wp-block-wporg-code-reference-comments .comment-list>li>.comment-body{padding-bottom:var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .comment-list>li>.comment-body>:not(.comment-meta){padding-inline-end:var(--wp--preset--spacing--20);padding-inline-start:var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .comment-list>li:not(:last-child){margin-bottom:var(--wp--preset--spacing--40)}.wp-block-wporg-code-reference-comments .comment-author-attribution a{color:var(--wp--preset--color--charcoal-1);font-weight:700;text-decoration:none}.wp-block-wporg-code-reference-comments .comment-date{color:var(--wp--preset--color--charcoal-4);margin-inline-end:calc(var(--wp--preset--spacing--10)/2);margin-inline-start:var(--wp--preset--spacing--10);text-decoration:none}.wp-block-wporg-code-reference-comments .comment-meta{align-items:center;background-color:var(--wp--preset--color--light-grey-2);border-bottom:1px solid var(--wp--preset--color--light-grey-1);display:flex;justify-content:space-between;padding:var(--wp--preset--spacing--10) var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .comment-author.vcard{display:flex}.wp-block-wporg-code-reference-comments .comment-meta+.wporg-has-embedded-code{margin-top:var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .children{margin-block-end:0;margin-top:var(--wp--preset--spacing--20);padding:0}.wp-block-wporg-code-reference-comments .children li{border-top:1px solid var(--wp--preset--color--light-grey-1);padding-top:var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .children li:not(:last-child){margin-bottom:var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .user-note-voting{align-items:center;display:flex}.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-count{font-weight:700}.wp-block-wporg-code-reference-comments .user-note-voting[data-can-vote=false] .user-note-voting-down,.wp-block-wporg-code-reference-comments .user-note-voting[data-can-vote=false] .user-note-voting-up{opacity:.25}.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-down,.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-up{align-items:center;display:flex;height:24px;justify-content:center;width:24px}.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-down:hover:after,.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-up:hover:after{border-color:var(--wp--preset--color--blueberry-1)}.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-down:after,.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-up:after{border-right:1px solid var(--wp--preset--color--charcoal-1);border-top:1px solid var(--wp--preset--color--charcoal-1);content:"";display:inline-block;height:5px;width:5px}.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-up:after{transform:rotate(-45deg) translate(-2px,2px)}.wp-block-wporg-code-reference-comments .user-note-voting .user-note-voting-down:after{transform:rotate(135deg)}.wp-block-wporg-code-reference-comments .bad-note .comment-content{opacity:.6}.wp-block-wporg-code-reference-comments .bad-note .comment-content:hover{opacity:1}.wp-block-wporg-code-reference-comments .feedback-editor{margin-top:var(--wp--preset--spacing--20)}.wp-block-wporg-code-reference-comments .submit{margin-top:8px}.wp-block-wporg-code-reference-comments .hide-if-js{display:none!important}.wp-block-wporg-code-reference-comments .wporg-developer-code-block .wp-code-block-button-container{align-items:normal}.wp-block-wporg-code-reference-comments .wporg-developer-code-block .wp-code-block-button-container code{display:none}.wp-block-wporg-code-reference-comments .wporg-developer-code-block .wp-code-block-button-container code+span{grid-column:2}.wp-block-wporg-code-reference-comments-rules{font-size:var(--wp--preset--font-size--extra-small);list-style:disc;margin:var(--wp--style--block-gap) 0;padding-inline-start:var(--wp--preset--spacing--20)}

/*# sourceURL=https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-comments/style-index.css */
</style>
<style id="wporg-table-of-contents-style-inline-css">
:where(.wp-block-wporg-table-of-contents){--local--line-height:var(--wp--custom--body--small--typography--line-height);--local--icon-size:calc(var(--local--line-height)*1em);font-size:var(--wp--preset--font-size--small)}@media (max-width:1299px){:where(.wp-block-wporg-table-of-contents){border:1px solid var(--wp--preset--color--light-grey-1);border-radius:2px}}.wporg-table-of-contents__header{position:relative}@media (max-width:1299px){.wporg-table-of-contents__header{padding:15px var(--wp--preset--spacing--20)}}.wporg-table-of-contents__header .wp-block-heading{margin-bottom:0}.wporg-table-of-contents__header .wporg-table-of-contents__toggle{align-items:center;background-color:initial;border:none;display:flex;height:100%;justify-content:flex-end;left:0;padding:0 var(--wp--preset--spacing--20) 0 0;position:absolute;top:0;width:100%}@media (min-width:1300px){.wporg-table-of-contents__header .wporg-table-of-contents__toggle{display:none}}.wporg-table-of-contents__header .wporg-table-of-contents__toggle:after{background-color:var(--wp--preset--color--charcoal-4);content:"";display:inline-block;height:var(--local--icon-size);mask-image:url(/wp-content/mu-plugins/pub-sync/blocks/table-of-contents/build/../images/chevron-small.svg);mask-position:center;mask-repeat:no-repeat;transform:rotate(-90deg);width:var(--local--icon-size)}.wporg-table-of-contents__header .wporg-table-of-contents__toggle[aria-expanded=true]:after{background-color:var(--wp--preset--color--charcoal-1);transform:revert}.wporg-table-of-contents__header .wporg-table-of-contents__toggle:focus-visible{outline:1px dashed var(--wp--preset--color--blueberry-1)}.wporg-table-of-contents__list{font-size:var(--wp--preset--font-size--small);line-height:1.6;list-style:none;margin-bottom:var(--wp--preset--spacing--20);margin-top:var(--wp--preset--spacing--20);padding-left:0}@media (max-width:1299px){.wporg-table-of-contents__list{display:none;margin-bottom:0;margin-top:0;padding:0 var(--wp--preset--spacing--20) 15px}}.wporg-table-of-contents__list li{color:var(--wp--preset--color--charcoal-4);margin-block:calc(var(--wp--preset--spacing--20)/4)}.wporg-table-of-contents__list li ul{list-style:none;padding-left:14px}.wporg-table-of-contents__list a{color:inherit;text-decoration-line:none}.wporg-table-of-contents__list a:hover{text-decoration-line:underline}.wporg-table-of-contents__list a:focus-visible{border-radius:2px;box-shadow:none;outline:1.5px solid var(--wp--preset--color--blueberry-1);outline-offset:2px}.is-toc-heading a{--local--icon-size:24px;align-items:center;color:inherit;display:inline-flex;padding-right:calc(var(--local--icon-size) + .1em)}.is-toc-heading a,.is-toc-heading a:after{-webkit-text-decoration:none!important;text-decoration:none!important}.is-toc-heading a:after{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iIzM4NThFOSIgZD0iTTEwIDE3LjM4OUg4LjQ0NEE1LjE5NCA1LjE5NCAwIDEgMSA4LjQ0NCA3SDEwdjEuNUg4LjQ0NGEzLjY5NCAzLjY5NCAwIDAgMCAwIDcuMzg5SDEwek0xNCA3aDEuNTU2YTUuMTk0IDUuMTk0IDAgMCAxIDAgMTAuMzlIMTR2LTEuNWgxLjU1NmEzLjY5NCAzLjY5NCAwIDAgMCAwLTcuMzlIMTR6bS00LjUgNmg1di0xLjVoLTV6Ii8+PC9zdmc+");background-position:100%;background-repeat:no-repeat;background-size:contain;content:"";display:inline-block;height:var(--local--icon-size);margin-right:calc(var(--local--icon-size)*-1 - .1em);opacity:0;width:calc(var(--local--icon-size) + .1em)}.is-toc-heading a:focus:after,.is-toc-heading a:hover:after,.is-toc-heading:focus a:after{opacity:1}.is-toc-heading:focus,.is-toc-heading:focus-visible{outline:none}.is-toc-heading:target{border-left:2px solid var(--wp--preset--color--blueberry-1);padding-left:8px}@media (min-width:890px){.is-toc-heading{scroll-margin-top:var(--wp--preset--spacing--20)}}
/*# sourceURL=https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/table-of-contents/build/style.css */
</style>
<style id="wporg-sidebar-container-style-inline-css">
.wp-block-wporg-sidebar-container{--local--offset-top:var(--wp-admin--admin-bar--height,0px);--local--nav--offset:var(--wp--custom--local-navigation-bar--spacing--height,60px)}@media (min-width:890px){.wp-block-wporg-sidebar-container{--local--offset-top:calc(var(--wp-admin--admin-bar--height, 0px) + var(--wp--custom--local-navigation-bar--spacing--height, 60px))}}.wp-block-wporg-sidebar-container .is-link-to-top{display:none}.wp-block-wporg-sidebar-container .is-link-to-top a{text-decoration-line:none}.wp-block-wporg-sidebar-container .is-link-to-top a:hover{text-decoration-line:underline}.wp-block-wporg-sidebar-container.is-floating-sidebar{--local--block-end-sidebar--width:340px;overflow-y:auto;overscroll-behavior:contain;padding-bottom:var(--wp--preset--spacing--20);scrollbar-color:var(--wp--preset--color--charcoal-5) #0000;width:var(--local--block-end-sidebar--width)}.wp-block-wporg-sidebar-container.is-floating-sidebar::-webkit-scrollbar,.wp-block-wporg-sidebar-container.is-floating-sidebar::-webkit-scrollbar-track{background-color:initial}.wp-block-wporg-sidebar-container.is-floating-sidebar::-webkit-scrollbar-thumb:active,.wp-block-wporg-sidebar-container.is-floating-sidebar::-webkit-scrollbar-thumb:hover{background-color:var(--wp--preset--color--charcoal-4)!important}.wp-block-wporg-sidebar-container.is-floating-sidebar:active::-webkit-scrollbar-thumb,.wp-block-wporg-sidebar-container.is-floating-sidebar:focus-within::-webkit-scrollbar-thumb,.wp-block-wporg-sidebar-container.is-floating-sidebar:focus::-webkit-scrollbar-thumb,.wp-block-wporg-sidebar-container.is-floating-sidebar:hover::-webkit-scrollbar-thumb{background-clip:content-box;background-color:var(--wp--preset--color--charcoal-5);border:4px solid #0000;border-radius:10px}.wp-block-wporg-sidebar-container.is-floating-sidebar>*{padding-right:16px}.wp-block-wporg-sidebar-container.is-floating-sidebar.is-fixed-sidebar{height:calc(100vh - var(--local--offset-top));inset-inline-end:var(--wp--preset--spacing--edge-space);margin-top:var(--local--offset-top)!important;padding:var(--wp--preset--spacing--20) 0;position:fixed;top:0}.wp-block-wporg-sidebar-container.is-floating-sidebar.is-fixed-sidebar .is-link-to-top{display:block}.wp-block-wporg-sidebar-container.is-floating-sidebar.is-fixed-sidebar .is-link-to-top a{color:var(--wp--preset--color--charcoal-4)}.wp-block-wporg-sidebar-container.is-floating-sidebar *+.is-link-to-top{border-top:1px solid var(--wp--preset--color--light-grey-1);padding-top:var(--wp--preset--spacing--20)}main .wp-block-wporg-sidebar-container{display:none}main .wp-block-wporg-sidebar-container.is-floating-sidebar{position:absolute}
/*# sourceURL=https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/sidebar-container/build/style.css */
</style>
<style id="wp-block-paragraph-inline-css">
.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:left;font-size:8.4em;font-style:normal;font-weight:100;line-height:.68;margin:.05em .1em 0 0;text-transform:uppercase}body.rtl .has-drop-cap:not(:focus):first-letter{float:none;margin-left:.1em}p.has-drop-cap.has-background{overflow:hidden}:root :where(p.has-background){padding:var(--wp--style--block-background-padding,1.25em 2.375em)}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}p.has-text-align-left[style*="writing-mode:vertical-lr"],p.has-text-align-right[style*="writing-mode:vertical-rl"]{rotate:180deg}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/paragraph/style.min.css */
</style>
<style id="wp-block-separator-inline-css">
@charset "UTF-8";.wp-block-separator{border:none;border-top:2px solid}:root :where(.wp-block-separator.is-style-dots){height:auto;line-height:1;text-align:center}:root :where(.wp-block-separator.is-style-dots):before{color:currentColor;content:"···";font-family:serif;font-size:1.5em;letter-spacing:2em;padding-left:2em}.wp-block-separator.is-style-dots{background:none!important;border:none!important}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/separator/style.min.css */
</style>
<style id="wp-block-list-inline-css">
ol,ul{box-sizing:border-box}:root :where(.wp-block-list.has-background){padding:var(--wp--style--block-background-padding,1.25em 2.375em)}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/list/style.min.css */
</style>
<style id="wp-block-post-content-inline-css">
.wp-block-post-content{display:flow-root}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/post-content/style.min.css */
</style>
<style id="wporg-code-reference-comment-form-style-inline-css">
.wp-block-wporg-code-reference-comment-form{padding-bottom:var(--wp--style--block-gap)}.wp-block-wporg-code-reference-comment-form p{margin-block-end:var(--wp--style--block-gap);margin-block-start:var(--wp--style--block-gap)}

/*# sourceURL=https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-comment-form/style-index.css */
</style>
<link rel='stylesheet' id='wp-block-social-links-css' href='https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/social-links/style.min.css?ver=24.1.0' media='all' />
<style id="wp-emoji-styles-inline-css">

	img.wp-smiley, img.emoji {
		display: inline !important;
		border: none !important;
		box-shadow: none !important;
		height: 1em !important;
		width: 1em !important;
		margin: 0 0.07em !important;
		vertical-align: -0.1em !important;
		background: none !important;
		padding: 0 !important;
	}
/*# sourceURL=wp-emoji-styles-inline-css */
</style>
<style id="wp-block-library-inline-css">
:root{--wp-block-synced-color:#7a00df;--wp-block-synced-color--rgb:122,0,223;--wp-bound-block-color:var(--wp-block-synced-color);--wp-editor-canvas-background:#ddd;--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,160.5;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.wp-element-button{cursor:pointer}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}:root .has-text-align-center{text-align:center}:root .has-text-align-left{text-align:left}:root .has-text-align-right{text-align:right}.has-fit-text{white-space:nowrap!important}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal!important;padding:0;position:absolute;width:1px;word-break:normal!important}.screen-reader-text:focus{background-color:#ddd;clip-path:none;color:#444;display:block;font-size:1em;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color){border-style:solid}html :where([style^=border-color],[style*=";border-color"],[style*="; border-color"]){border-style:solid}html :where([style^=border-top-color],[style*=";border-top-color"],[style*="; border-top-color"]){border-top-style:solid}html :where([style^=border-right-color],[style*=";border-right-color"],[style*="; border-right-color"]){border-right-style:solid}html :where([style^=border-bottom-color],[style*=";border-bottom-color"],[style*="; border-bottom-color"]){border-bottom-style:solid}html :where([style^=border-left-color],[style*=";border-left-color"],[style*="; border-left-color"]){border-left-style:solid}html :where([style^=border-width],[style*=";border-width"],[style*="; border-width"]){border-style:solid}html :where([style^=border-top-width],[style*=";border-top-width"],[style*="; border-top-width"]){border-top-style:solid}html :where([style^=border-right-width],[style*=";border-right-width"],[style*="; border-right-width"]){border-right-style:solid}html :where([style^=border-bottom-width],[style*=";border-bottom-width"],[style*="; border-bottom-width"]){border-bottom-style:solid}html :where([style^=border-left-width],[style*=";border-left-width"],[style*="; border-left-width"]){border-left-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}:where(figure){margin:0 0 1em}html :where(.is-position-sticky){--wp-admin--admin-bar--position-offset:var(--wp-admin--admin-bar--height,0px)}@media screen and (max-width:600px){html :where(.is-position-sticky){--wp-admin--admin-bar--position-offset:0px}}
/*# sourceURL=https://developer.wordpress.org/wp-content/plugins/gutenberg/build/styles/block-library/common.min.css */
</style>
<style id="wp-block-template-skip-link-inline-css">
/*! This file is auto-generated */
.skip-link.screen-reader-text{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;width:1px;word-wrap:normal!important;word-break:normal!important}.skip-link.screen-reader-text:focus{background-color:#eee;clip-path:none;color:#444;display:block;font-size:1em;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}
/*# sourceURL=/wp-includes/css/wp-block-template-skip-link.min.css */
</style>
<style id="global-styles-inline-css">
:root{--wp--preset--aspect-ratio--square: 1;--wp--preset--aspect-ratio--4-3: 4/3;--wp--preset--aspect-ratio--3-4: 3/4;--wp--preset--aspect-ratio--3-2: 3/2;--wp--preset--aspect-ratio--2-3: 2/3;--wp--preset--aspect-ratio--16-9: 16/9;--wp--preset--aspect-ratio--9-16: 9/16;--wp--preset--color--black: #000000;--wp--preset--color--cyan-bluish-gray: #abb8c3;--wp--preset--color--white: #ffffff;--wp--preset--color--pale-pink: #f78da7;--wp--preset--color--vivid-red: #cf2e2e;--wp--preset--color--luminous-vivid-orange: #ff6900;--wp--preset--color--luminous-vivid-amber: #fcb900;--wp--preset--color--light-green-cyan: #7bdcb5;--wp--preset--color--vivid-green-cyan: #00d084;--wp--preset--color--pale-cyan-blue: #8ed1fc;--wp--preset--color--vivid-cyan-blue: #0693e3;--wp--preset--color--vivid-purple: #9b51e0;--wp--preset--color--charcoal-0: #1a1919;--wp--preset--color--charcoal-1: #1e1e1e;--wp--preset--color--charcoal-2: #23282d;--wp--preset--color--charcoal-3: #40464d;--wp--preset--color--charcoal-4: #656a71;--wp--preset--color--charcoal-5: #979aa1;--wp--preset--color--light-grey-1: #d9d9d9;--wp--preset--color--light-grey-2: #f6f6f6;--wp--preset--color--white-opacity-15: #ffffff26;--wp--preset--color--black-opacity-15: #00000026;--wp--preset--color--dark-blueberry: #1d35b4;--wp--preset--color--deep-blueberry: #213fd4;--wp--preset--color--blueberry-1: #3858e9;--wp--preset--color--blueberry-2: #9fb1ff;--wp--preset--color--blueberry-3: #c7d1ff;--wp--preset--color--blueberry-4: #eff2ff;--wp--preset--color--pomegrade-1: #e26f56;--wp--preset--color--pomegrade-2: #ffb7a7;--wp--preset--color--pomegrade-3: #ffe9de;--wp--preset--color--acid-green-1: #33f078;--wp--preset--color--acid-green-2: #c7ffdb;--wp--preset--color--acid-green-3: #e2ffed;--wp--preset--color--lemon-1: #fff972;--wp--preset--color--lemon-2: #fffcb5;--wp--preset--color--lemon-3: #fffdd6;--wp--preset--color--purple-1: #5300be;--wp--preset--color--purple-2: #7a00df;--wp--preset--color--purple-3: #d7a7ff;--wp--preset--color--aquamarine: #6ec9ae;--wp--preset--color--linen: #fbfaf7;--wp--preset--color--syntax-black: var(--wp--preset--color--black);--wp--preset--color--syntax-red: var(--wp--custom--color--red-50);--wp--preset--color--syntax-green: var(--wp--custom--color--green-50);--wp--preset--color--syntax-blue: var(--wp--custom--color--blue-60);--wp--preset--color--syntax-grey: var(--wp--custom--color--grey-50);--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple: linear-gradient(135deg,rgb(6,147,227) 0%,rgb(155,81,224) 100%);--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan: linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%);--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange: linear-gradient(135deg,rgb(252,185,0) 0%,rgb(255,105,0) 100%);--wp--preset--gradient--luminous-vivid-orange-to-vivid-red: linear-gradient(135deg,rgb(255,105,0) 0%,rgb(207,46,46) 100%);--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray: linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%);--wp--preset--gradient--cool-to-warm-spectrum: linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%);--wp--preset--gradient--blush-light-purple: linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%);--wp--preset--gradient--blush-bordeaux: linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%);--wp--preset--gradient--luminous-dusk: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%);--wp--preset--gradient--pale-ocean: linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%);--wp--preset--gradient--electric-grass: linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%);--wp--preset--gradient--midnight: linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%);--wp--preset--font-size--small: 14px;--wp--preset--font-size--medium: 20px;--wp--preset--font-size--large: 20px;--wp--preset--font-size--x-large: 42px;--wp--preset--font-size--extra-small: 12px;--wp--preset--font-size--normal: 16px;--wp--preset--font-size--extra-large: 24px;--wp--preset--font-size--huge: 32px;--wp--preset--font-size--heading-6: 18px;--wp--preset--font-size--heading-5: 20px;--wp--preset--font-size--heading-4: 24px;--wp--preset--font-size--heading-3: 29px;--wp--preset--font-size--heading-2: 32px;--wp--preset--font-size--heading-1: 38px;--wp--preset--font-size--heading-cta: 120px;--wp--preset--font-family--eb-garamond: 'EB Garamond', serif;--wp--preset--font-family--inter: 'Inter', sans-serif;--wp--preset--font-family--monospace: 'IBM Plex Mono', monospace;--wp--preset--font-family--ibm-plex-sans: 'IBM Plex Sans', san-serif;--wp--preset--text-shadow--light: 0.05em 0.05em 0.1em rgba(0, 0, 0, 0.3);--wp--preset--text-shadow--strong: 0.1em 0.1em 0.25em rgba(0, 0, 0, 0.5);--wp--preset--spacing--20: 20px;--wp--preset--spacing--30: 30px;--wp--preset--spacing--40: clamp(30px, 5vw, 50px);--wp--preset--spacing--50: clamp(40px, calc(5vw + 10px), 60px);--wp--preset--spacing--60: clamp(20px, calc(10vw - 40px), 80px);--wp--preset--spacing--70: 100px;--wp--preset--spacing--80: clamp(80px, calc(6.67vw + 40px), 120px);--wp--preset--spacing--edge-space: 80px;--wp--preset--spacing--10: 10px;--wp--preset--spacing--90: clamp(80px, 13.33vw, 160px);--wp--preset--shadow--natural: 6px 6px 9px rgba(0, 0, 0, 0.2);--wp--preset--shadow--deep: 12px 12px 50px rgba(0, 0, 0, 0.4);--wp--preset--shadow--sharp: 6px 6px 0px rgba(0, 0, 0, 0.2);--wp--preset--shadow--outlined: 6px 6px 0px -3px rgb(255, 255, 255), 6px 6px rgb(0, 0, 0);--wp--preset--shadow--crisp: 6px 6px 0px rgb(0, 0, 0);--wp--custom--button--color--background: var(--wp--preset--color--blueberry-1);--wp--custom--button--color--text: var(--wp--preset--color--white);--wp--custom--button--border--color: var(--wp--preset--color--blueberry-1);--wp--custom--button--border--radius: 2px;--wp--custom--button--border--style: solid;--wp--custom--button--border--width: 1px;--wp--custom--button--hover--color--background: var(--wp--preset--color--deep-blueberry);--wp--custom--button--hover--color--text: var(--wp--preset--color--white);--wp--custom--button--focus--border--color: var(--wp--preset--color--blueberry-1);--wp--custom--button--active--border--color: var(--wp--preset--color--blueberry-1);--wp--custom--button--active--color--background: var(--wp--preset--color--charcoal-1);--wp--custom--button--active--color--text: var(--wp--preset--color--white);--wp--custom--button--outline--border--color: currentColor;--wp--custom--button--outline--color--background: transparent;--wp--custom--button--outline--color--text: var(--wp--preset--color--blueberry-1);--wp--custom--button--outline--hover--border--color: var(--wp--preset--color--blueberry-1);--wp--custom--button--outline--hover--color--background: var(--wp--preset--color--deep-blueberry);--wp--custom--button--outline--hover--color--text: var(--wp--preset--color--white);--wp--custom--button--outline--focus--border--color: var(--wp--preset--color--blueberry-1);--wp--custom--button--outline--focus--color--background: var(--wp--preset--color--blueberry-1);--wp--custom--button--outline--focus--color--text: var(--wp--preset--color--white);--wp--custom--button--outline--active--border--color: var(--wp--preset--color--charcoal-1);--wp--custom--button--outline--active--color--background: var(--wp--preset--color--charcoal-1);--wp--custom--button--outline--active--color--text: var(--wp--preset--color--white);--wp--custom--button--small--spacing--padding--top: 7px;--wp--custom--button--small--spacing--padding--bottom: 7px;--wp--custom--button--small--spacing--padding--left: 12px;--wp--custom--button--small--spacing--padding--right: 12px;--wp--custom--button--small--typography--font-size: var(--wp--preset--font-size--small);--wp--custom--button--spacing--padding--top: 14px;--wp--custom--button--spacing--padding--bottom: 14px;--wp--custom--button--spacing--padding--left: 32px;--wp--custom--button--spacing--padding--right: 32px;--wp--custom--button--text--typography--font-weight: 400;--wp--custom--button--typography--font-size: var(--wp--preset--font-size--normal);--wp--custom--button--typography--font-weight: 600;--wp--custom--button--typography--line-height: 1.3;--wp--custom--form--padding--inline: calc(var(--wp--preset--spacing--10) * 1.5);--wp--custom--form--padding--block: calc(var(--wp--preset--spacing--10) * 0.8);--wp--custom--form--border--color: var(--wp--preset--color--charcoal-5);--wp--custom--form--border--radius: 2px;--wp--custom--form--border--style: solid;--wp--custom--form--border--width: 1px;--wp--custom--form--color--label: inherit;--wp--custom--form--color--background: var(--wp--preset--color--white);--wp--custom--form--color--text: var(--wp--preset--color--charcoal-1);--wp--custom--form--color--box-shadow: none;--wp--custom--form--typography--font-size: var(--wp--preset--font-size--small);--wp--custom--form--typography--line-height: var(--wp--custom--body--small--typography--line-height);--wp--custom--form--active--color--background: var(--wp--preset--color--white);--wp--custom--form--active--color--text: var(--wp--preset--color--charcoal-1);--wp--custom--form--search--color--label: var(--wp--preset--color--charcoal-4);--wp--custom--form--search--color--background: var(--wp--preset--color--light-grey-2);--wp--custom--form--search--color--text: var(--wp--preset--color--charcoal-1);--wp--custom--form--search--border--width: 0;--wp--custom--gallery--caption--font-size: var(--wp--preset--font-size--small);--wp--custom--body--typography--line-height: 1.875;--wp--custom--body--typography--text-wrap: pretty;--wp--custom--body--short-text--typography--line-height: 1.625;--wp--custom--body--extra-small--typography--line-height: 1.67;--wp--custom--body--small--typography--line-height: 1.714;--wp--custom--body--large--typography--line-height: 1.7;--wp--custom--body--extra-large--typography--line-height: 1.58;--wp--custom--body--extra-large--breakpoint--small-only--typography--font-size: 20px;--wp--custom--body--extra-large--breakpoint--small-only--typography--line-height: 1.5;--wp--custom--body--huge--typography--line-height: 1.5;--wp--custom--heading--typography--font-family: var(--wp--preset--font-family--inter);--wp--custom--heading--typography--font-weight: 400;--wp--custom--heading--typography--line-height: 1.2;--wp--custom--heading--typography--text-wrap: balance;--wp--custom--heading--cta--typography--line-height: 1;--wp--custom--heading--cta--breakpoint--small-only--typography--font-size: 52px;--wp--custom--heading--cta--breakpoint--small-only--typography--line-height: 1.08;--wp--custom--heading--level-1--typography--line-height: 1.2;--wp--custom--heading--level-1--breakpoint--small-only--typography--font-size: 26px;--wp--custom--heading--level-1--breakpoint--small-only--typography--line-height: 1.2;--wp--custom--heading--level-2--typography--line-height: 1.2;--wp--custom--heading--level-2--breakpoint--small-only--typography--font-size: 24px;--wp--custom--heading--level-2--breakpoint--small-only--typography--line-height: 1.2;--wp--custom--heading--level-3--typography--line-height: 1.2;--wp--custom--heading--level-3--breakpoint--small-only--typography--font-size: 22px;--wp--custom--heading--level-3--breakpoint--small-only--typography--line-height: 1.2;--wp--custom--heading--level-3--inter--typography--font-size: 29px;--wp--custom--heading--level-3--inter--typography--line-height: 1.4;--wp--custom--heading--level-3--inter--breakpoint--small-only--typography--font-size: 21px;--wp--custom--heading--level-4--typography--line-height: 1.2;--wp--custom--heading--level-4--breakpoint--small-only--typography--font-size: 20px;--wp--custom--heading--level-4--breakpoint--small-only--typography--line-height: 1.2;--wp--custom--heading--level-4--inter--typography--font-size: 24px;--wp--custom--heading--level-4--inter--typography--line-height: 1.4;--wp--custom--heading--level-4--inter--breakpoint--small-only--typography--font-size: 19px;--wp--custom--heading--level-5--typography--line-height: 1.2;--wp--custom--heading--level-5--breakpoint--small-only--typography--font-size: 18px;--wp--custom--heading--level-5--breakpoint--small-only--typography--line-height: 1.2;--wp--custom--heading--level-5--inter--typography--font-size: 20px;--wp--custom--heading--level-5--inter--typography--line-height: 1.4;--wp--custom--heading--level-5--inter--breakpoint--small-only--typography--font-size: 17px;--wp--custom--heading--level-6--typography--line-height: 1.2;--wp--custom--heading--level-6--breakpoint--small-only--typography--font-size: 16px;--wp--custom--heading--level-6--breakpoint--small-only--typography--line-height: 1.2;--wp--custom--heading--level-6--inter--typography--font-size: 18px;--wp--custom--heading--level-6--inter--typography--line-height: 1.4;--wp--custom--heading--level-6--inter--breakpoint--small-only--typography--font-size: 16px;--wp--custom--layout--content-size: 680px;--wp--custom--layout--wide-size: 1160px;--wp--custom--layout--content-meta-size: calc( var(--wp--custom--layout--wide-size) - var(--wp--custom--layout--content-size) );--wp--custom--link--color--text: var(--wp--preset--color--blueberry-1);--wp--custom--list--spacing--padding--left: var(--wp--custom--margin--horizontal);--wp--custom--margin--baseline: 10px;--wp--custom--margin--horizontal: 30px;--wp--custom--margin--vertical: 30px;--wp--custom--post-comment--typography--font-size: var(--wp--preset--font-size--normal);--wp--custom--post-comment--typography--line-height: var(--wp--custom--body--typography--line-height);--wp--custom--pullquote--breakpoint--medium--typography--font-size: 50px;--wp--custom--pullquote--citation--breakpoint--medium--typography--font-size: 30px;--wp--custom--pullquote--citation--typography--font-size: 20px;--wp--custom--pullquote--citation--typography--font-family: inherit;--wp--custom--pullquote--citation--typography--font-style: italic;--wp--custom--pullquote--citation--spacing--margin--top: var(--wp--custom--margin--vertical);--wp--custom--pullquote--spacing--min-height: 430px;--wp--custom--pullquote--typography--font-size: 40px;--wp--custom--pullquote--typography--line-height: 1.4;--wp--custom--pullquote--typography--text-align: left;--wp--custom--quote--citation--typography--font-size: 20px;--wp--custom--quote--citation--typography--font-family: inherit;--wp--custom--quote--citation--typography--font-style: normal;--wp--custom--quote--typography--text-align: left;--wp--custom--separator--opacity: 1;--wp--custom--separator--margin: var(--wp--custom--margin--vertical) auto;--wp--custom--separator--width: 150px;--wp--custom--latest-news--link--color: var(--wp--preset--color--charcoal-1);--wp--custom--latest-news--link--spacing: var(--wp--preset--spacing--10);--wp--custom--latest-news--link--details--font-size: var(--wp--preset--font-size--small);--wp--custom--latest-news--spacing: var(--wp--preset--spacing--40);--wp--custom--latest-news--title--font-family: var(--wp--preset--font-family--eb-garamond);--wp--custom--latest-news--title--font-size: var(--wp--preset--font-size--normal);--wp--custom--latest-news--title--line-height: var(--wp--custom--heading--level-3--typography--line-height);--wp--custom--brush-stroke--spacing--height: 16px;--wp--custom--color--blue-60: #135e96;--wp--custom--color--blue-60-alpha-10: #135e9619;--wp--custom--color--green-50: #008a20;--wp--custom--color--green-50-alpha-5: #008a200C;--wp--custom--color--green-60: #007017;--wp--custom--color--grey-50: #646970;--wp--custom--color--red-50: #d63638;--wp--custom--color--red-50-alpha-5: #d636380C;--wp--custom--color--red-60: #b32d2e;--wp--custom--color--yellow-40: #bd8600;--wp--custom--color--yellow-40-alpha-5: #bd86000C;--wp--custom--color--yellow-50: #996800;--wp--custom--select--height: 40px;--wp--custom--select--icon-size: 24px;--wp--custom--select--icon-position: 8px;--wp--custom--select--padding-left: 12px;--wp--custom--select--font-size: var(--wp--preset--font-size--small);--wp--custom--select--line-height: var(--wp--custom--body--typography--line-height);--wp--custom--select--padding-vertical: calc(( var(--wp--custom--select--height) - (var(--wp--custom--select--font-size) * var(--wp--custom--select--line-height))) / 2);--wp--custom--select--border-radius: var(--wp--custom--button--border--radius);--wp--custom--wporg-command-github--color--open: var(--wp--custom--color--green-60);--wp--custom--wporg-command-github--color--closed: var(--wp--custom--color--red-60);--wp--custom--wporg-code-short-title--color--class: var(--wp--custom--color--yellow-40);--wp--custom--wporg-code-short-title--color--class-type: var(--wp--custom--color--yellow-50);--wp--custom--wporg-code-short-title--color--function: var(--wp--custom--color--green-50);--wp--custom--wporg-code-short-title--color--function-type: var(--wp--custom--color--green-60);--wp--custom--wporg-code-short-title--color--hook: var(--wp--custom--color--red-50);--wp--custom--wporg-code-short-title--color--hook-type: var(--wp--custom--color--red-60);--wp--custom--wporg-code-short-title--color--method: var(--wp--custom--color--blue-60);--wp--custom--wporg-code-short-title--background-color--class-type: var(--wp--custom--color--yellow-40-alpha-5);--wp--custom--wporg-code-short-title--background-color--function-type: var(--wp--custom--color--green-50-alpha-5);--wp--custom--wporg-code-short-title--background-color--hook-type: var(--wp--custom--color--red-50-alpha-5);--wp--custom--wporg-code-short-title--background-color--method-type: var(--wp--custom--color--blue-60-alpha-10);}.wp-block-button{--wp--preset--dimension--25: 25%;--wp--preset--dimension--50: 50%;--wp--preset--dimension--75: 75%;--wp--preset--dimension--100: 100%;}.wp-block-post-comments-form{--wp--custom--form--border--width: 1px;--wp--custom--form--border--style: solid;--wp--custom--form--border--color: var(--wp--preset--color--charcoal-5);}:root { --wp--style--global--content-size: 960px;--wp--style--global--wide-size: 1160px; }:where(body) { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }:where(.wp-site-blocks) > * { margin-block-start: 20px; margin-block-end: 0; }:where(.wp-site-blocks) > :first-child { margin-block-start: 0; }:where(.wp-site-blocks) > :last-child { margin-block-end: 0; }:root { --wp--style--block-gap: 20px; }:root :where(.is-layout-flow) > :first-child{margin-block-start: 0;}:root :where(.is-layout-flow) > :last-child{margin-block-end: 0;}:root :where(.is-layout-flow) > *{margin-block-start: 20px;margin-block-end: 0;}:root :where(.is-layout-constrained) > :first-child{margin-block-start: 0;}:root :where(.is-layout-constrained) > :last-child{margin-block-end: 0;}:root :where(.is-layout-constrained) > *{margin-block-start: 20px;margin-block-end: 0;}:root :where(.is-layout-flex){gap: 20px;}:root :where(.is-layout-grid){gap: 20px;}.is-layout-flow > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}.is-layout-flow > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}.is-layout-flow > .aligncenter{margin-left: auto !important;margin-right: auto !important;}.is-layout-constrained > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}.is-layout-constrained > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}.is-layout-constrained > .aligncenter{margin-left: auto !important;margin-right: auto !important;}.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)){max-width: var(--wp--style--global--content-size);margin-left: auto !important;margin-right: auto !important;}.is-layout-constrained > .alignwide{max-width: var(--wp--style--global--wide-size);}body .is-layout-flex{display: flex;}.is-layout-flex{flex-wrap: wrap;align-items: center;}.is-layout-flex > :is(*, div){margin: 0;}body .is-layout-grid{display: grid;}.is-layout-grid > :is(*, div){margin: 0;}body{background-color: var(--wp--preset--color--white);color: var(--wp--preset--color--charcoal-1);font-family: var(--wp--preset--font-family--inter);font-size: var(--wp--preset--font-size--normal);line-height: var(--wp--custom--body--typography--line-height);padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;}a:where(:not(.wp-element-button)){color: var(--wp--custom--link--color--text);text-decoration: underline;}:root :where(a:where(:not(.wp-element-button)):hover){text-decoration: none;}h1{font-family: var(--wp--custom--heading--typography--font-family);font-size: var(--wp--preset--font-size--heading-1);font-weight: var(--wp--custom--heading--typography--font-weight);line-height: var(--wp--custom--heading--level-1--typography--line-height);}h2{font-family: var(--wp--custom--heading--typography--font-family);font-size: var(--wp--preset--font-size--heading-4);font-weight: 600;line-height: var(--wp--custom--heading--level-2--typography--line-height);margin-top: 0;margin-bottom: var(--wp--style--block-gap);}h3{font-family: var(--wp--custom--heading--typography--font-family);font-size: var(--wp--preset--font-size--heading-5);font-weight: 600;line-height: var(--wp--custom--heading--level-3--typography--line-height);}h4{font-family: var(--wp--custom--heading--typography--font-family);font-size: var(--wp--preset--font-size--heading-6);font-weight: 600;line-height: var(--wp--custom--heading--level-4--typography--line-height);}h5{font-family: var(--wp--custom--heading--typography--font-family);font-size: var(--wp--preset--font-size--heading-6);font-weight: var(--wp--custom--heading--typography--font-weight);line-height: var(--wp--custom--heading--level-5--typography--line-height);}h6{font-family: var(--wp--custom--heading--typography--font-family);font-size: var(--wp--preset--font-size--heading-6);font-weight: var(--wp--custom--heading--typography--font-weight);line-height: var(--wp--custom--heading--level-6--typography--line-height);}:root :where(.wp-element-button, .wp-block-button__link){background-color: #32373c;border-width: 0;color: #fff;font-family: inherit;font-size: inherit;font-style: inherit;font-weight: inherit;letter-spacing: inherit;line-height: inherit;padding-top: calc(0.667em + 2px);padding-right: calc(1.333em + 2px);padding-bottom: calc(0.667em + 2px);padding-left: calc(1.333em + 2px);text-decoration: none;text-transform: inherit;}:root :where(.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption){color: var(--wp--preset--color--charcoal-4);font-size: var(--wp--custom--gallery--caption--font-size);margin-top: 1em;margin-bottom: 1em;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-color{color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-color{color: var(--wp--preset--color--white) !important;}.has-pale-pink-color{color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-color{color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-color{color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-color{color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-color{color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-color{color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-color{color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-color{color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-color{color: var(--wp--preset--color--vivid-purple) !important;}.has-charcoal-0-color{color: var(--wp--preset--color--charcoal-0) !important;}.has-charcoal-1-color{color: var(--wp--preset--color--charcoal-1) !important;}.has-charcoal-2-color{color: var(--wp--preset--color--charcoal-2) !important;}.has-charcoal-3-color{color: var(--wp--preset--color--charcoal-3) !important;}.has-charcoal-4-color{color: var(--wp--preset--color--charcoal-4) !important;}.has-charcoal-5-color{color: var(--wp--preset--color--charcoal-5) !important;}.has-light-grey-1-color{color: var(--wp--preset--color--light-grey-1) !important;}.has-light-grey-2-color{color: var(--wp--preset--color--light-grey-2) !important;}.has-white-opacity-15-color{color: var(--wp--preset--color--white-opacity-15) !important;}.has-black-opacity-15-color{color: var(--wp--preset--color--black-opacity-15) !important;}.has-dark-blueberry-color{color: var(--wp--preset--color--dark-blueberry) !important;}.has-deep-blueberry-color{color: var(--wp--preset--color--deep-blueberry) !important;}.has-blueberry-1-color{color: var(--wp--preset--color--blueberry-1) !important;}.has-blueberry-2-color{color: var(--wp--preset--color--blueberry-2) !important;}.has-blueberry-3-color{color: var(--wp--preset--color--blueberry-3) !important;}.has-blueberry-4-color{color: var(--wp--preset--color--blueberry-4) !important;}.has-pomegrade-1-color{color: var(--wp--preset--color--pomegrade-1) !important;}.has-pomegrade-2-color{color: var(--wp--preset--color--pomegrade-2) !important;}.has-pomegrade-3-color{color: var(--wp--preset--color--pomegrade-3) !important;}.has-acid-green-1-color{color: var(--wp--preset--color--acid-green-1) !important;}.has-acid-green-2-color{color: var(--wp--preset--color--acid-green-2) !important;}.has-acid-green-3-color{color: var(--wp--preset--color--acid-green-3) !important;}.has-lemon-1-color{color: var(--wp--preset--color--lemon-1) !important;}.has-lemon-2-color{color: var(--wp--preset--color--lemon-2) !important;}.has-lemon-3-color{color: var(--wp--preset--color--lemon-3) !important;}.has-purple-1-color{color: var(--wp--preset--color--purple-1) !important;}.has-purple-2-color{color: var(--wp--preset--color--purple-2) !important;}.has-purple-3-color{color: var(--wp--preset--color--purple-3) !important;}.has-aquamarine-color{color: var(--wp--preset--color--aquamarine) !important;}.has-linen-color{color: var(--wp--preset--color--linen) !important;}.has-syntax-black-color{color: var(--wp--preset--color--syntax-black) !important;}.has-syntax-red-color{color: var(--wp--preset--color--syntax-red) !important;}.has-syntax-green-color{color: var(--wp--preset--color--syntax-green) !important;}.has-syntax-blue-color{color: var(--wp--preset--color--syntax-blue) !important;}.has-syntax-grey-color{color: var(--wp--preset--color--syntax-grey) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-background-color{background-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-pale-pink-background-color{background-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-background-color{background-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-background-color{background-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-background-color{background-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-background-color{background-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-background-color{background-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-background-color{background-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-background-color{background-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-background-color{background-color: var(--wp--preset--color--vivid-purple) !important;}.has-charcoal-0-background-color{background-color: var(--wp--preset--color--charcoal-0) !important;}.has-charcoal-1-background-color{background-color: var(--wp--preset--color--charcoal-1) !important;}.has-charcoal-2-background-color{background-color: var(--wp--preset--color--charcoal-2) !important;}.has-charcoal-3-background-color{background-color: var(--wp--preset--color--charcoal-3) !important;}.has-charcoal-4-background-color{background-color: var(--wp--preset--color--charcoal-4) !important;}.has-charcoal-5-background-color{background-color: var(--wp--preset--color--charcoal-5) !important;}.has-light-grey-1-background-color{background-color: var(--wp--preset--color--light-grey-1) !important;}.has-light-grey-2-background-color{background-color: var(--wp--preset--color--light-grey-2) !important;}.has-white-opacity-15-background-color{background-color: var(--wp--preset--color--white-opacity-15) !important;}.has-black-opacity-15-background-color{background-color: var(--wp--preset--color--black-opacity-15) !important;}.has-dark-blueberry-background-color{background-color: var(--wp--preset--color--dark-blueberry) !important;}.has-deep-blueberry-background-color{background-color: var(--wp--preset--color--deep-blueberry) !important;}.has-blueberry-1-background-color{background-color: var(--wp--preset--color--blueberry-1) !important;}.has-blueberry-2-background-color{background-color: var(--wp--preset--color--blueberry-2) !important;}.has-blueberry-3-background-color{background-color: var(--wp--preset--color--blueberry-3) !important;}.has-blueberry-4-background-color{background-color: var(--wp--preset--color--blueberry-4) !important;}.has-pomegrade-1-background-color{background-color: var(--wp--preset--color--pomegrade-1) !important;}.has-pomegrade-2-background-color{background-color: var(--wp--preset--color--pomegrade-2) !important;}.has-pomegrade-3-background-color{background-color: var(--wp--preset--color--pomegrade-3) !important;}.has-acid-green-1-background-color{background-color: var(--wp--preset--color--acid-green-1) !important;}.has-acid-green-2-background-color{background-color: var(--wp--preset--color--acid-green-2) !important;}.has-acid-green-3-background-color{background-color: var(--wp--preset--color--acid-green-3) !important;}.has-lemon-1-background-color{background-color: var(--wp--preset--color--lemon-1) !important;}.has-lemon-2-background-color{background-color: var(--wp--preset--color--lemon-2) !important;}.has-lemon-3-background-color{background-color: var(--wp--preset--color--lemon-3) !important;}.has-purple-1-background-color{background-color: var(--wp--preset--color--purple-1) !important;}.has-purple-2-background-color{background-color: var(--wp--preset--color--purple-2) !important;}.has-purple-3-background-color{background-color: var(--wp--preset--color--purple-3) !important;}.has-aquamarine-background-color{background-color: var(--wp--preset--color--aquamarine) !important;}.has-linen-background-color{background-color: var(--wp--preset--color--linen) !important;}.has-syntax-black-background-color{background-color: var(--wp--preset--color--syntax-black) !important;}.has-syntax-red-background-color{background-color: var(--wp--preset--color--syntax-red) !important;}.has-syntax-green-background-color{background-color: var(--wp--preset--color--syntax-green) !important;}.has-syntax-blue-background-color{background-color: var(--wp--preset--color--syntax-blue) !important;}.has-syntax-grey-background-color{background-color: var(--wp--preset--color--syntax-grey) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-border-color{border-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-pale-pink-border-color{border-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-border-color{border-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-border-color{border-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-border-color{border-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-border-color{border-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-border-color{border-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-border-color{border-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-border-color{border-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-border-color{border-color: var(--wp--preset--color--vivid-purple) !important;}.has-charcoal-0-border-color{border-color: var(--wp--preset--color--charcoal-0) !important;}.has-charcoal-1-border-color{border-color: var(--wp--preset--color--charcoal-1) !important;}.has-charcoal-2-border-color{border-color: var(--wp--preset--color--charcoal-2) !important;}.has-charcoal-3-border-color{border-color: var(--wp--preset--color--charcoal-3) !important;}.has-charcoal-4-border-color{border-color: var(--wp--preset--color--charcoal-4) !important;}.has-charcoal-5-border-color{border-color: var(--wp--preset--color--charcoal-5) !important;}.has-light-grey-1-border-color{border-color: var(--wp--preset--color--light-grey-1) !important;}.has-light-grey-2-border-color{border-color: var(--wp--preset--color--light-grey-2) !important;}.has-white-opacity-15-border-color{border-color: var(--wp--preset--color--white-opacity-15) !important;}.has-black-opacity-15-border-color{border-color: var(--wp--preset--color--black-opacity-15) !important;}.has-dark-blueberry-border-color{border-color: var(--wp--preset--color--dark-blueberry) !important;}.has-deep-blueberry-border-color{border-color: var(--wp--preset--color--deep-blueberry) !important;}.has-blueberry-1-border-color{border-color: var(--wp--preset--color--blueberry-1) !important;}.has-blueberry-2-border-color{border-color: var(--wp--preset--color--blueberry-2) !important;}.has-blueberry-3-border-color{border-color: var(--wp--preset--color--blueberry-3) !important;}.has-blueberry-4-border-color{border-color: var(--wp--preset--color--blueberry-4) !important;}.has-pomegrade-1-border-color{border-color: var(--wp--preset--color--pomegrade-1) !important;}.has-pomegrade-2-border-color{border-color: var(--wp--preset--color--pomegrade-2) !important;}.has-pomegrade-3-border-color{border-color: var(--wp--preset--color--pomegrade-3) !important;}.has-acid-green-1-border-color{border-color: var(--wp--preset--color--acid-green-1) !important;}.has-acid-green-2-border-color{border-color: var(--wp--preset--color--acid-green-2) !important;}.has-acid-green-3-border-color{border-color: var(--wp--preset--color--acid-green-3) !important;}.has-lemon-1-border-color{border-color: var(--wp--preset--color--lemon-1) !important;}.has-lemon-2-border-color{border-color: var(--wp--preset--color--lemon-2) !important;}.has-lemon-3-border-color{border-color: var(--wp--preset--color--lemon-3) !important;}.has-purple-1-border-color{border-color: var(--wp--preset--color--purple-1) !important;}.has-purple-2-border-color{border-color: var(--wp--preset--color--purple-2) !important;}.has-purple-3-border-color{border-color: var(--wp--preset--color--purple-3) !important;}.has-aquamarine-border-color{border-color: var(--wp--preset--color--aquamarine) !important;}.has-linen-border-color{border-color: var(--wp--preset--color--linen) !important;}.has-syntax-black-border-color{border-color: var(--wp--preset--color--syntax-black) !important;}.has-syntax-red-border-color{border-color: var(--wp--preset--color--syntax-red) !important;}.has-syntax-green-border-color{border-color: var(--wp--preset--color--syntax-green) !important;}.has-syntax-blue-border-color{border-color: var(--wp--preset--color--syntax-blue) !important;}.has-syntax-grey-border-color{border-color: var(--wp--preset--color--syntax-grey) !important;}.has-vivid-cyan-blue-to-vivid-purple-gradient-background{background: var(--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple) !important;}.has-light-green-cyan-to-vivid-green-cyan-gradient-background{background: var(--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan) !important;}.has-luminous-vivid-amber-to-luminous-vivid-orange-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange) !important;}.has-luminous-vivid-orange-to-vivid-red-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-orange-to-vivid-red) !important;}.has-very-light-gray-to-cyan-bluish-gray-gradient-background{background: var(--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray) !important;}.has-cool-to-warm-spectrum-gradient-background{background: var(--wp--preset--gradient--cool-to-warm-spectrum) !important;}.has-blush-light-purple-gradient-background{background: var(--wp--preset--gradient--blush-light-purple) !important;}.has-blush-bordeaux-gradient-background{background: var(--wp--preset--gradient--blush-bordeaux) !important;}.has-luminous-dusk-gradient-background{background: var(--wp--preset--gradient--luminous-dusk) !important;}.has-pale-ocean-gradient-background{background: var(--wp--preset--gradient--pale-ocean) !important;}.has-electric-grass-gradient-background{background: var(--wp--preset--gradient--electric-grass) !important;}.has-midnight-gradient-background{background: var(--wp--preset--gradient--midnight) !important;}.has-small-font-size{font-size: var(--wp--preset--font-size--small) !important;}.has-medium-font-size{font-size: var(--wp--preset--font-size--medium) !important;}.has-large-font-size{font-size: var(--wp--preset--font-size--large) !important;}.has-x-large-font-size{font-size: var(--wp--preset--font-size--x-large) !important;}.has-extra-small-font-size{font-size: var(--wp--preset--font-size--extra-small) !important;}.has-normal-font-size{font-size: var(--wp--preset--font-size--normal) !important;}.has-extra-large-font-size{font-size: var(--wp--preset--font-size--extra-large) !important;}.has-huge-font-size{font-size: var(--wp--preset--font-size--huge) !important;}.has-heading-6-font-size{font-size: var(--wp--preset--font-size--heading-6) !important;}.has-heading-5-font-size{font-size: var(--wp--preset--font-size--heading-5) !important;}.has-heading-4-font-size{font-size: var(--wp--preset--font-size--heading-4) !important;}.has-heading-3-font-size{font-size: var(--wp--preset--font-size--heading-3) !important;}.has-heading-2-font-size{font-size: var(--wp--preset--font-size--heading-2) !important;}.has-heading-1-font-size{font-size: var(--wp--preset--font-size--heading-1) !important;}.has-heading-cta-font-size{font-size: var(--wp--preset--font-size--heading-cta) !important;}.has-eb-garamond-font-family{font-family: var(--wp--preset--font-family--eb-garamond) !important;}.has-inter-font-family{font-family: var(--wp--preset--font-family--inter) !important;}.has-monospace-font-family{font-family: var(--wp--preset--font-family--monospace) !important;}.has-ibm-plex-sans-font-family{font-family: var(--wp--preset--font-family--ibm-plex-sans) !important;}.has-light-text-shadow{text-shadow: var(--wp--preset--text-shadow--light) !important;}.has-strong-text-shadow{text-shadow: var(--wp--preset--text-shadow--strong) !important;}
:root :where(.wp-block-code){font-family: var(--wp--preset--font-family--monospace);}
:root :where(.wp-block-navigation){font-size: var(--wp--preset--font-size--normal);}
:root :where(.wp-block-separator){border-color: currentColor;border-width: 0 0 1px 0;border-style: solid;}
:root :where(.wp-block-site-title){font-size: clamp(20px, calc(100vw / 12), 120px);}
:root :where(.wp-block-site-title a:where(:not(.wp-element-button))){text-decoration: none;}
:root :where(.wp-block-site-title a:where(:not(.wp-element-button)):hover){text-decoration: underline;}
:root :where(.wp-block-wporg-code-reference-title){font-family: var(--wp--preset--font-family--monospace);font-size: var(--wp--preset--font-size--extra-large);font-weight: 400;line-height: 1.73;}
/*# sourceURL=global-styles-inline-css */
</style>
<style id="core-block-supports-inline-css">
.wp-container-core-navigation-is-layout-bd946717{flex-direction:column;align-items:flex-start;}.wp-elements-1 a:where(:not(.wp-element-button)){color:var(--wp--preset--color--white);}.wp-elements-1 a:where(:not(.wp-element-button)):hover{color:var(--wp--preset--color--white);}.wp-container-core-group-is-layout-d14b0e0f{flex-wrap:nowrap;gap:0;}.wp-container-wporg-local-navigation-bar-is-layout-1567b4e4{flex-wrap:nowrap;justify-content:space-between;}.wp-container-7{position:sticky;z-index:10;}.wp-container-core-group-is-layout-71ccf642{justify-content:space-between;}.wp-container-core-post-content-is-layout-4479b7c2 > *{margin-block-start:0;margin-block-end:0;}.wp-container-core-post-content-is-layout-4479b7c2 > * + *{margin-block-start:var(--wp--preset--spacing--40);margin-block-end:0;}.wp-container-core-group-is-layout-dc2ac831{flex-direction:column;align-items:flex-start;}.wp-container-core-group-is-layout-18d46422 > .alignfull{margin-right:calc(var(--wp--preset--spacing--edge-space) * -1);margin-left:calc(var(--wp--preset--spacing--edge-space) * -1);}.wp-container-core-group-is-layout-3fccc9c5{grid-template-columns:repeat(auto-fill, minmax(min(150px, 100%), 1fr));container-type:inline-size;gap:var(--wp--preset--spacing--20);}.wp-container-core-group-is-layout-e1f0195b{flex-wrap:nowrap;justify-content:flex-start;}
/*# sourceURL=core-block-supports-inline-css */
</style>
<link rel='stylesheet' id='mkaz-code-syntax-prism-css-css' href='https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/prism/style-index.css?ver=1784196542' media='all' />
<style id="jetpack-stats-inline-css">
img#wpstats{display:none}
/*# sourceURL=jetpack-stats-inline-css */
</style>
<link rel='stylesheet' id='wporg-global-fonts-css' href='https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/global-fonts/style.css?ver=1781196416' media='all' />
<link rel='stylesheet' id='wporg-parent-block-styles-css' href='https://developer.wordpress.org/wp-content/themes/wporg-parent-2021/build/block-styles.css?ver=1781196442' media='all' />
<link rel='stylesheet' id='wporg-parent-2021-style-css' href='https://developer.wordpress.org/wp-content/themes/wporg-parent-2021/build/style.css?ver=1781196442' media='all' />
<link rel='stylesheet' id='wporg-parent-2021-print-css' href='https://developer.wordpress.org/wp-content/themes/wporg-parent-2021/build/print.css?ver=1781196442' media='print' />
<link rel='stylesheet' id='wporg-handbook-css-css' href='https://developer.wordpress.org/wp-content/plugins/handbook/stylesheets/callout-boxes.css?ver=20200121' media='all' />
<link rel='stylesheet' id='wporg-developer-2023-style-css' href='https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/style/style-index.css?ver=1789388829' media='all' />
<link rel='stylesheet' id='awesomplete-css-css' href='https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/stylesheets/awesomplete.css?ver=1781196441' media='all' />
<link rel='stylesheet' id='autocomplete-css-css' href='https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/stylesheets/autocomplete.css?ver=1781196441' media='all' />
<link rel='stylesheet' id='wporg-global-header-footer-css' href='https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/global-header-footer/build/style.css?ver=1791211855' media='all' />
<script data-wp-strategy="defer" defer id="wporg-local-navigation-bar-view-script-js" src="https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/local-navigation-bar/build/view.js?ver=2ae6cba4cf35f434c642"></script>
<script data-wp-strategy="defer" defer id="wporg-code-table-view-script-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/build/code-table/view.js?ver=40f38467b27da310e17d"></script>
<script data-wp-strategy="defer" defer id="wporg-table-of-contents-view-script-js" src="https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/table-of-contents/build/view.js?ver=f15f873b2ba45df7f9af"></script>
<script data-wp-strategy="defer" defer id="wporg-sidebar-container-view-script-js" src="https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/sidebar-container/build/view.js?ver=1e1976f74a9ea13a47a3"></script>
<script id="jquery-core-js" src="https://developer.wordpress.org/wp-includes/js/jquery/jquery.min.js?ver=3.7.1"></script>
<script id="jquery-migrate-js" src="https://developer.wordpress.org/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.6.0"></script>
<script id="wporg-handbook-js" src="https://developer.wordpress.org/wp-content/plugins/handbook/scripts/handbook.js?ver=20150930"></script>
<link rel="https://api.w.org/" href="https://developer.wordpress.org/wp-json/" /><link rel="alternate" title="JSON" type="application/json" href="https://developer.wordpress.org/wp-json/wp/v2/wp-parser-class/2839" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://developer.wordpress.org/xmlrpc.php?rsd" />
<meta name="generator" content="WordPress 7.2-alpha-64251" />
<link rel='shortlink' href='https://developer.wordpress.org/?p=2839' />
<link rel="canonical" href="https://developer.wordpress.org/reference/classes/wp_query/">
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <!-- Stream WordPress user activity plugin v4.4.0 -->
		<style>
			a.github-edit {
				margin-left: .5em;
				font-size: .5em;
				vertical-align: top;
				display: inline-block;
				border: 1px solid #eeeeee;
				border-radius: 2px;
				background: #eeeeee;
				padding: .5em .6em .4em;
				color: black;
				margin-top: 0.1em;
			}
			a.github-edit > * {
				opacity: 0.6;
			}
			a.github-edit:hover > * {
				opacity: 1;
				color: black;
			}
			a.github-edit img {
				height: .8em;
			}
		</style>
		<script id="wp-importmap" type="importmap">
{"imports":{"@wordpress/interactivity":"https://developer.wordpress.org/wp-content/plugins/gutenberg/build/modules/interactivity/index.min.js?ver=b0929e0bd08daccaa778"}}
</script>
<link rel="modulepreload" href="https://developer.wordpress.org/wp-content/plugins/gutenberg/build/modules/interactivity/index.min.js?ver=b0929e0bd08daccaa778" id="@wordpress/interactivity-js-modulepreload" fetchpriority="low">
<link rel="icon" href="https://s.w.org/favicon.ico?2" sizes="32x32" />
<link rel="icon" href="https://s.w.org/images/wmark.png" sizes="192x192" />
<link rel="apple-touch-icon" href="https://s.w.org/images/wmark.png" />
<meta name="msapplication-TileImage" content="https://s.w.org/images/wmark.png" />
</head>

<body class="wp-singular wp-parser-class-template-default single single-wp-parser-class postid-2839 wp-embed-responsive wp-theme-wporg-parent-2021 wp-child-theme-wporg-developer-2023">
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P24PF4B" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
	<script id='jetpack-search-theme-token-sampler'>(function(){try{var c=getComputedStyle(document.body),r=document.documentElement,ink=c.color,bg=c.backgroundColor;if(ink){r.style.setProperty('--jp-search-page-ink',ink);}if(bg&&bg!==ink&&bg!=='rgba(0, 0, 0, 0)'&&bg!=='transparent'){r.style.setProperty('--jp-search-page-surface',bg);}}catch(e){}})();</script>
<a class="skip-link screen-reader-text" id="wp-skip-link" href="#wp--skip-link--target">Skip to content</a><div class="wp-site-blocks"><div class="has-display-contents wp-block-template-part"><!--
	This template part is not called directly from any templates, it's swapped out automatically by `modify_header_template_part`.
	It should be used on "Level 3+" pages, pages with at least 2 ancestors (for example, Home > Handbook home > Article).
-->

<header style="border-bottom-width:1px;border-bottom-color:var(--wp--preset--color--white-opacity-15);border-bottom-style:solid" class="global-header wp-block-group wp-block-wporg-global-header">

<figure class="wp-block-image global-header__wporg-logo-mark">
	<a href="https://wordpress.org/">
		<svg xmlns="http://www.w3.org/2000/svg" role="img" width="28" height="28" viewBox="0 0 28 28">
	<title>WordPress.org</title>
	<path fill="currentColor" d="M13.6052 0.923525C16.1432 0.923525 18.6137 1.67953 20.7062 3.09703C22.7447 4.47403 24.3512 6.41803 25.3097 8.68603C26.9837 12.6415 26.5382 17.164 24.1352 20.7145C22.7582 22.753 20.8142 24.3595 18.5462 25.318C14.5907 26.992 10.0682 26.5465 6.51772 24.1435C4.47922 22.7665 2.87272 20.8225 1.91422 18.5545C0.240225 14.599 0.685725 10.0765 3.08872 6.52603C4.46572 4.48753 6.40973 2.88103 8.67772 1.92253C10.2302 1.26103 11.9177 0.923525 13.6052 0.923525ZM13.6052 0.113525C6.15322 0.113525 0.105225 6.16153 0.105225 13.6135C0.105225 21.0655 6.15322 27.1135 13.6052 27.1135C21.0572 27.1135 27.1052 21.0655 27.1052 13.6135C27.1052 6.16153 21.0572 0.113525 13.6052 0.113525Z" />
	<path fill="currentColor" d="M2.36011 13.6133C2.36011 17.9198 4.81711 21.8618 8.70511 23.7383L3.33211 9.03684C2.68411 10.4813 2.36011 12.0338 2.36011 13.6133ZM21.2061 13.0463C21.2061 11.6558 20.7066 10.6973 20.2746 9.94134C19.8426 9.18534 19.1676 8.22684 19.1676 7.30884C19.1676 6.39084 19.9506 5.31084 21.0576 5.31084H21.2061C16.6296 1.11234 9.51511 1.42284 5.31661 6.01284C4.91161 6.45834 4.53361 6.93084 4.20961 7.43034H4.93861C6.11311 7.43034 7.93561 7.28184 7.93561 7.28184C8.54311 7.24134 8.61061 8.13234 8.00311 8.21334C8.00311 8.21334 7.39561 8.28084 6.72061 8.32134L10.8111 20.5118L13.2681 13.1273L11.5131 8.32134C10.9056 8.28084 10.3386 8.21334 10.3386 8.21334C9.73111 8.17284 9.79861 7.25484 10.4061 7.28184C10.4061 7.28184 12.2691 7.43034 13.3626 7.43034C14.4561 7.43034 16.3596 7.28184 16.3596 7.28184C16.9671 7.24134 17.0346 8.13234 16.4271 8.21334C16.4271 8.21334 15.8196 8.28084 15.1446 8.32134L19.2081 20.4173L20.3691 16.7453C20.8821 15.1388 21.1926 14.0048 21.1926 13.0328L21.2061 13.0463ZM13.7946 14.5853L10.4196 24.3998C12.6876 25.0613 15.1041 25.0073 17.3316 24.2243L17.2506 24.0758L13.7946 14.5853ZM23.4741 8.21334C23.5281 8.59134 23.5551 8.98284 23.5551 9.37434C23.5551 10.5218 23.3391 11.8043 22.7046 13.3973L19.2621 23.3333C24.5271 20.2688 26.4036 13.5593 23.4741 8.21334Z" />
</svg>	</a>
</figure>



<nav class="is-responsive global-header__navigation wp-block-navigation is-horizontal is-layout-flex wp-block-navigation-is-layout-flex" aria-label="Main" 
		 data-wp-interactive="core/navigation" data-wp-context='{"overlayOpenedBy":{"click":false,"hover":false,"focus":false},"type":"overlay","roleAttribute":"","ariaLabel":"Menu"}'><button aria-haspopup="dialog" aria-label="Open menu" class="wp-block-navigation__responsive-container-open" 
				data-wp-on--click="actions.openMenuOnClick"
				data-wp-on--keydown="actions.handleMenuKeydown"
			><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 7.5h16v1.5H4z"></path><path d="M4 15h16v1.5H4z"></path></svg></button>
				<div class="wp-block-navigation__responsive-container"  id="modal-1" 
				data-wp-class--has-modal-open="state.isMenuOpen"
				data-wp-class--is-menu-open="state.isMenuOpen"
				data-wp-watch="callbacks.initMenu"
				data-wp-on--keydown="actions.handleMenuKeydown"
				data-wp-on--focusout="actions.handleMenuFocusout"
				tabindex="-1"
			>
					<div class="wp-block-navigation__responsive-close" tabindex="-1">
						<div class="wp-block-navigation__responsive-dialog" 
				data-wp-bind--aria-modal="state.ariaModal"
				data-wp-bind--aria-label="state.ariaLabel"
				data-wp-bind--role="state.roleAttribute"
			>
							<button aria-label="Close menu" class="wp-block-navigation__responsive-container-close" 
				data-wp-on--click="actions.closeMenuOnClick"
			><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path></svg></button>
							<div class="wp-block-navigation__responsive-container-content" 
				data-wp-watch="callbacks.focusFirstElement"
			 id="modal-1-content">
								<ul class="wp-block-navigation__container is-responsive global-header__navigation wp-block-navigation" aria-label="Main"><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/showcase/"><span class="wp-block-navigation-item__label">Showcase</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/plugins/"><span class="wp-block-navigation-item__label">Plugins</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/themes/"><span class="wp-block-navigation-item__label">Themes</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/hosting/"><span class="wp-block-navigation-item__label">Hosting</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/news/"><span class="wp-block-navigation-item__label">News</span></a></li><li data-wp-context="{ &quot;submenuOpenedBy&quot;: { &quot;click&quot;: false, &quot;hover&quot;: false, &quot;focus&quot;: false }, &quot;type&quot;: &quot;submenu&quot;, &quot;modal&quot;: null, &quot;previousFocus&quot;: null }" data-wp-interactive="core/navigation" data-wp-on--focusout="actions.handleMenuFocusout" data-wp-on--keydown="actions.handleMenuKeydown" data-wp-watch="callbacks.initMenu" tabindex="-1" class="wp-block-navigation-item has-child open-on-click wp-block-navigation-submenu"><button data-wp-bind--aria-expanded="state.isSubmenuOpen" data-wp-on--click="actions.toggleMenuOnClick" aria-label="Resources submenu" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" ><span class="wp-block-navigation-item__label">Resources</span></button><span class="wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span><ul data-wp-on--focus="actions.openMenuOnFocus" class="wp-block-navigation__submenu-container wp-block-navigation-submenu"><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://learn.wordpress.org/"><span class="wp-block-navigation-item__label">Learn WordPress</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/documentation/"><span class="wp-block-navigation-item__label">Documentation</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/education/"><span class="wp-block-navigation-item__label">Education</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/support/forums/"><span class="wp-block-navigation-item__label">Forums</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/"><span class="wp-block-navigation-item__label">Developers</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/blocks/"><span class="wp-block-navigation-item__label">Blocks</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/patterns/"><span class="wp-block-navigation-item__label">Patterns</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/photos/"><span class="wp-block-navigation-item__label">Photos</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://openverse.org/"><span class="wp-block-navigation-item__label">Openverse <span aria-hidden="true" class="wp-exclude-emoji">↗</span>︎</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.tv/"><span class="wp-block-navigation-item__label">WordPress.tv <span aria-hidden="true" class="wp-exclude-emoji">↗</span>︎</span></a></li></ul></li><li data-wp-context="{ &quot;submenuOpenedBy&quot;: { &quot;click&quot;: false, &quot;hover&quot;: false, &quot;focus&quot;: false }, &quot;type&quot;: &quot;submenu&quot;, &quot;modal&quot;: null, &quot;previousFocus&quot;: null }" data-wp-interactive="core/navigation" data-wp-on--focusout="actions.handleMenuFocusout" data-wp-on--keydown="actions.handleMenuKeydown" data-wp-watch="callbacks.initMenu" tabindex="-1" class="wp-block-navigation-item has-child open-on-click wp-block-navigation-submenu"><button data-wp-bind--aria-expanded="state.isSubmenuOpen" data-wp-on--click="actions.toggleMenuOnClick" aria-label="About submenu" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" ><span class="wp-block-navigation-item__label">About</span></button><span class="wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span><ul data-wp-on--focus="actions.openMenuOnFocus" class="wp-block-navigation__submenu-container wp-block-navigation-submenu"><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/about/"><span class="wp-block-navigation-item__label">About WordPress</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://make.wordpress.org/"><span class="wp-block-navigation-item__label">Make WordPress</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://events.wordpress.org/"><span class="wp-block-navigation-item__label">Events</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/five-for-the-future/"><span class="wp-block-navigation-item__label">Five for the Future</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/enterprise/"><span class="wp-block-navigation-item__label">Enterprise</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/gutenberg/"><span class="wp-block-navigation-item__label">Gutenberg <span aria-hidden="true" class="wp-exclude-emoji">↗</span>︎</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://jobs.wordpress.net/"><span class="wp-block-navigation-item__label">Job Board <span aria-hidden="true" class="wp-exclude-emoji">↗</span>︎</span></a></li></ul></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://mercantile.wordpress.org/"><span class="wp-block-navigation-item__label">Swag <span aria-hidden="true" class="wp-exclude-emoji">↗</span>︎</span></a></li><li class="wp-block-navigation-item global-header__mobile-get-wordpress global-header__get-wordpress wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://wordpress.org/download/"><span class="wp-block-navigation-item__label">Get WordPress</span></a></li></ul>
								
							</div>
						</div>
					</div>
				</div></nav>

<!--
	The search block is inside a navigation menu because that provides the exact functionality the design
	calls for. It also provides a consistent experience with the primary navigation menu, with respect to
	keyboard navigation, ARIA states, etc. It also saves having to write custom code for all the interactions.
-->
<nav class="is-responsive is-vertical global-header__search wp-block-navigation is-layout-flex wp-container-core-navigation-is-layout-bd946717 wp-block-navigation-is-layout-flex" aria-label="Search" 
		 data-wp-interactive="core/navigation" data-wp-context='{"overlayOpenedBy":{"click":false,"hover":false,"focus":false},"type":"overlay","roleAttribute":"","ariaLabel":"Menu"}'><button aria-haspopup="dialog" aria-label="Open menu" class="wp-block-navigation__responsive-container-open always-shown" 
				data-wp-on--click="actions.openMenuOnClick"
				data-wp-on--keydown="actions.handleMenuKeydown"
			><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 7.5h16v1.5H4z"></path><path d="M4 15h16v1.5H4z"></path></svg></button>
				<div class="wp-block-navigation__responsive-container hidden-by-default"  id="modal-4" 
				data-wp-class--has-modal-open="state.isMenuOpen"
				data-wp-class--is-menu-open="state.isMenuOpen"
				data-wp-watch="callbacks.initMenu"
				data-wp-on--keydown="actions.handleMenuKeydown"
				data-wp-on--focusout="actions.handleMenuFocusout"
				tabindex="-1"
			>
					<div class="wp-block-navigation__responsive-close" tabindex="-1">
						<div class="wp-block-navigation__responsive-dialog" 
				data-wp-bind--aria-modal="state.ariaModal"
				data-wp-bind--aria-label="state.ariaLabel"
				data-wp-bind--role="state.roleAttribute"
			>
							<button aria-label="Close menu" class="wp-block-navigation__responsive-container-close" 
				data-wp-on--click="actions.closeMenuOnClick"
			><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path></svg></button>
							<div class="wp-block-navigation__responsive-container-content" 
				data-wp-watch="callbacks.focusFirstElement"
			 id="modal-4-content">
								<form role="search" method="get" action="https://wordpress.org/search/do-search.php" class="wp-block-search__button-inside wp-block-search__icon-button wp-block-navigation-item wp-block-search" ><label class="wp-block-search__label" for="wp-block-search__input-3" >Search in WordPress.org</label><div class="wp-block-search__inside-wrapper" ><input class="wp-block-search__input" id="wp-block-search__input-3" placeholder="Type to search…" value="" type="search" name="s" required /><button aria-label="Search" class="wp-block-search__button has-icon wp-element-button" type="submit" ><svg class="search-icon" viewBox="0 0 24 24" width="24" height="24">
					<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"></path>
				</svg></button></div></form>
								
							</div>
						</div>
					</div>
				</div></nav>

<!-- This is the first of two Get WordPress buttons; the other is in the navigation menu.
	Two are needed because they have different DOM hierarchies at different breakpoints. -->

<div class="global-header__desktop-get-wordpress-container is-layout-flow wp-block-group-is-layout-flow">
	<a href="https://wordpress.org/download/" class="global-header__desktop-get-wordpress global-header__get-wordpress">
		Get WordPress	</a>
</div> 
</header>


<div class="alignfull has-display-contents wp-elements-1 wp-block-wporg-local-navigation-bar has-text-color has-white-color has-background has-charcoal-2-background-color has-small-font-size is-content-justification-space-between is-nowrap is-layout-flex wp-container-wporg-local-navigation-bar-is-layout-1567b4e4 wp-block-wporg-local-navigation-bar-is-layout-flex wp-container-7 is-position-sticky" >
	<figure class="wp-block-image global-header__wporg-logo-mark">
		<a href="https://wordpress.org/">
			<svg xmlns="http://www.w3.org/2000/svg" role="img" width="28" height="28" viewBox="0 0 28 28">
	<title>WordPress.org</title>
	<path fill="currentColor" d="M13.6052 0.923525C16.1432 0.923525 18.6137 1.67953 20.7062 3.09703C22.7447 4.47403 24.3512 6.41803 25.3097 8.68603C26.9837 12.6415 26.5382 17.164 24.1352 20.7145C22.7582 22.753 20.8142 24.3595 18.5462 25.318C14.5907 26.992 10.0682 26.5465 6.51772 24.1435C4.47922 22.7665 2.87272 20.8225 1.91422 18.5545C0.240225 14.599 0.685725 10.0765 3.08872 6.52603C4.46572 4.48753 6.40973 2.88103 8.67772 1.92253C10.2302 1.26103 11.9177 0.923525 13.6052 0.923525ZM13.6052 0.113525C6.15322 0.113525 0.105225 6.16153 0.105225 13.6135C0.105225 21.0655 6.15322 27.1135 13.6052 27.1135C21.0572 27.1135 27.1052 21.0655 27.1052 13.6135C27.1052 6.16153 21.0572 0.113525 13.6052 0.113525Z" />
	<path fill="currentColor" d="M2.36011 13.6133C2.36011 17.9198 4.81711 21.8618 8.70511 23.7383L3.33211 9.03684C2.68411 10.4813 2.36011 12.0338 2.36011 13.6133ZM21.2061 13.0463C21.2061 11.6558 20.7066 10.6973 20.2746 9.94134C19.8426 9.18534 19.1676 8.22684 19.1676 7.30884C19.1676 6.39084 19.9506 5.31084 21.0576 5.31084H21.2061C16.6296 1.11234 9.51511 1.42284 5.31661 6.01284C4.91161 6.45834 4.53361 6.93084 4.20961 7.43034H4.93861C6.11311 7.43034 7.93561 7.28184 7.93561 7.28184C8.54311 7.24134 8.61061 8.13234 8.00311 8.21334C8.00311 8.21334 7.39561 8.28084 6.72061 8.32134L10.8111 20.5118L13.2681 13.1273L11.5131 8.32134C10.9056 8.28084 10.3386 8.21334 10.3386 8.21334C9.73111 8.17284 9.79861 7.25484 10.4061 7.28184C10.4061 7.28184 12.2691 7.43034 13.3626 7.43034C14.4561 7.43034 16.3596 7.28184 16.3596 7.28184C16.9671 7.24134 17.0346 8.13234 16.4271 8.21334C16.4271 8.21334 15.8196 8.28084 15.1446 8.32134L19.2081 20.4173L20.3691 16.7453C20.8821 15.1388 21.1926 14.0048 21.1926 13.0328L21.2061 13.0463ZM13.7946 14.5853L10.4196 24.3998C12.6876 25.0613 15.1041 25.0073 17.3316 24.2243L17.2506 24.0758L13.7946 14.5853ZM23.4741 8.21334C23.5281 8.59134 23.5551 8.98284 23.5551 9.37434C23.5551 10.5218 23.3391 11.8043 22.7046 13.3973L19.2621 23.3333C24.5271 20.2688 26.4036 13.5593 23.4741 8.21334Z" />
</svg>		</a>
	</figure>
	

	
	<div class="wp-block-group has-light-grey-1-color has-text-color is-nowrap is-layout-flex wp-container-core-group-is-layout-d14b0e0f wp-block-group-is-layout-flex">
		<p class="wp-block-site-title has-text-color has-white-color has-small-font-size"><a href="https://developer.wordpress.org" target="_self" rel="home">WordPress Developer Resources</a></p>

		<p class="wporg-local-navigation-bar__fade-in-scroll wp-block-wporg-page-title has-small-font-size">WP_Query</p>
	</div>
	

	<nav class="has-small-font-size is-responsive wp-block-navigation is-horizontal is-layout-flex wp-block-navigation-is-layout-flex" aria-label="Section" 
		 data-wp-interactive="core/navigation" data-wp-context='{"overlayOpenedBy":{"click":false,"hover":false,"focus":false},"type":"overlay","roleAttribute":"","ariaLabel":"Menu"}'><button aria-haspopup="dialog" aria-label="Open menu" class="wp-block-navigation__responsive-container-open" 
				data-wp-on--click="actions.openMenuOnClick"
				data-wp-on--keydown="actions.handleMenuKeydown"
			><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"></path></svg></button>
				<div class="wp-block-navigation__responsive-container has-text-color has-white-color has-background has-charcoal-2-background-color"  id="modal-5" 
				data-wp-class--has-modal-open="state.isMenuOpen"
				data-wp-class--is-menu-open="state.isMenuOpen"
				data-wp-watch="callbacks.initMenu"
				data-wp-on--keydown="actions.handleMenuKeydown"
				data-wp-on--focusout="actions.handleMenuFocusout"
				tabindex="-1"
			>
					<div class="wp-block-navigation__responsive-close" tabindex="-1">
						<div class="wp-block-navigation__responsive-dialog" 
				data-wp-bind--aria-modal="state.ariaModal"
				data-wp-bind--aria-label="state.ariaLabel"
				data-wp-bind--role="state.roleAttribute"
			>
							<button aria-label="Close menu" class="wp-block-navigation__responsive-container-close" 
				data-wp-on--click="actions.closeMenuOnClick"
			><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"></path></svg></button>
							<div class="wp-block-navigation__responsive-container-content" 
				data-wp-watch="callbacks.focusFirstElement"
			 id="modal-5-content">
								<ul class="wp-block-navigation__container has-small-font-size is-responsive wp-block-navigation" aria-label="Section"><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/news/"><span class="wp-block-navigation-item__label">Developer Blog</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/reference/"><span class="wp-block-navigation-item__label">Code Reference</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/cli/commands/"><span class="wp-block-navigation-item__label">WP-CLI Commands</span></a></li></ul>
								
							</div>
						</div>
					</div>
				</div></nav><nav class="has-small-font-size is-responsive wporg-is-collapsed-nav wp-block-navigation is-horizontal is-layout-flex wp-block-navigation-is-layout-flex" aria-label="Section 2" 
		 data-wp-interactive="core/navigation" data-wp-context='{"overlayOpenedBy":{"click":false,"hover":false,"focus":false},"type":"overlay","roleAttribute":"","ariaLabel":"Menu"}'><button aria-haspopup="dialog" aria-label="Open menu" class="wp-block-navigation__responsive-container-open always-shown" 
				data-wp-on--click="actions.openMenuOnClick"
				data-wp-on--keydown="actions.handleMenuKeydown"
			><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"></path></svg></button>
				<div class="wp-block-navigation__responsive-container hidden-by-default has-text-color has-white-color has-background has-charcoal-2-background-color"  id="modal-6" 
				data-wp-class--has-modal-open="state.isMenuOpen"
				data-wp-class--is-menu-open="state.isMenuOpen"
				data-wp-watch="callbacks.initMenu"
				data-wp-on--keydown="actions.handleMenuKeydown"
				data-wp-on--focusout="actions.handleMenuFocusout"
				tabindex="-1"
			>
					<div class="wp-block-navigation__responsive-close" tabindex="-1">
						<div class="wp-block-navigation__responsive-dialog" 
				data-wp-bind--aria-modal="state.ariaModal"
				data-wp-bind--aria-label="state.ariaLabel"
				data-wp-bind--role="state.roleAttribute"
			>
							<button aria-label="Close menu" class="wp-block-navigation__responsive-container-close" 
				data-wp-on--click="actions.closeMenuOnClick"
			><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"></path></svg></button>
							<div class="wp-block-navigation__responsive-container-content" 
				data-wp-watch="callbacks.focusFirstElement"
			 id="modal-6-content">
								<ul class="wp-block-navigation__container has-small-font-size is-responsive wporg-is-collapsed-nav wp-block-navigation" aria-label="Section"><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/news/"><span class="wp-block-navigation-item__label">Developer Blog</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/reference/"><span class="wp-block-navigation-item__label">Code Reference</span></a></li><li class="wp-block-navigation-item wp-block-navigation-link"><a class="wp-block-navigation-item__content"  href="https://developer.wordpress.org/cli/commands/"><span class="wp-block-navigation-item__label">WP-CLI Commands</span></a></li></ul>
								
							</div>
						</div>
					</div>
				</div></nav>

</div>



<div class="wporg-breadcrumbs wp-block-group alignfull has-white-background-color has-background is-content-justification-space-between is-layout-flex wp-container-core-group-is-layout-71ccf642 wp-block-group-is-layout-flex" style="padding-top:18px;padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:18px;padding-left:var(--wp--preset--spacing--edge-space)">

	<div role="navigation" aria-label="Breadcrumbs" class="wp-block-wporg-site-breadcrumbs has-small-font-size"><div class="wporg-site-breadcrumbs__wrapper"><span><a href="https://developer.wordpress.org">Home</a></span><span><a href="https://developer.wordpress.org/reference/">Reference</a></span><span><a href="https://developer.wordpress.org/reference/classes/">Classes</a></span><span class="is-current-page">WP_Query</span></div></div>

</div>

</div>

<div class="has-display-contents wp-block-template-part">
<div class="wp-block-group alignfull is-layout-flow wp-block-group-is-layout-flow" style="padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)">

	

<div id="wporg-search" class="wp-block-group alignwide is-layout-flow wp-block-group-is-layout-flow" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)">

	<form role="search" method="get" action="https://developer.wordpress.org/" class="wp-block-search__button-inside wp-block-search__icon-button wp-block-search" ><label class="wp-block-search__label screen-reader-text" for="wp-block-search__input-8" >Search</label><div class="wp-block-search__inside-wrapper"  style="width: 232px"><input class="wp-block-search__input" id="wp-block-search__input-8" placeholder="Search resources" value="" type="search" name="s" required /><button aria-label="Search" class="wp-block-search__button has-icon wp-element-button" type="submit" ><svg class="search-icon" viewBox="0 0 24 24" width="24" height="24">
					<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"></path>
				</svg></button></div></form>

</div>



</div>

</div>


<div class="wp-block-group alignfull is-layout-constrained wp-container-core-group-is-layout-18d46422 wp-block-group-is-layout-constrained" style="padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)">
	
	
	<div class="wp-block-group alignleft has-three-columns is-vertical is-layout-flex wp-container-core-group-is-layout-dc2ac831 wp-block-group-is-layout-flex">
		
		
		<main id="wp--skip-link--target" class="wp-block-group alignwide is-layout-flow wp-block-group-is-layout-flow">

			
			<article class="wp-block-group is-layout-flow wp-block-group-is-layout-flow">
				
				<h1 style="margin-bottom:40px" class="wp-block-wporg-code-reference-title"><span class="keyword">class</span> WP_Query {}</h1>

				
<div class="wp-block-wporg-sidebar-container is-layout-flow wp-block-wporg-sidebar-container-is-layout-flow" data-breakpoint="1300px">

	<div class="wp-block-wporg-table-of-contents"><div class="wporg-table-of-contents__header">
		<h2 class="wp-block-heading has-inter-font-family has-normal-font-size" style="margin-top:0;margin-bottom:0;font-style:normal;font-weight:400">In this article</h2>
		<button type="button" class="wporg-table-of-contents__toggle" aria-expanded="false"><span class="screen-reader-text">Table of Contents</span></button></div><ul class="wporg-table-of-contents__list"><li><a href="#more-information">More Information</a></li>
<li><a href="#usage">Usage</a>
<ul>
<li><a href="#standard-loop">Standard Loop</a></li>
<li><a href="#standard-loop-alternate">Standard Loop (Alternate)</a></li>
<li><a href="#multiple-loops">Multiple Loops</a>
</ul></li>
<li><a href="#properties-and-methods">Properties and Methods</a>
<ul>
<li><a href="#properties">Properties</a>
</ul></li>
<li><a href="#parameters">Parameters</a>
<ul>
<li><a href="#author-parameters">Author Parameters</a></li>
<li><a href="#category-parameters">Category Parameters</a></li>
<li><a href="#tag-parameters">Tag Parameters</a></li>
<li><a href="#taxonomy-parameters">Taxonomy Parameters</a></li>
<li><a href="#search-parameters">Search Parameters</a></li>
<li><a href="#post-page-parameters">Post &amp; Page Parameters</a></li>
<li><a href="#password-parameters">Password Parameters</a></li>
<li><a href="#post-type-parameters">Post Type Parameters</a></li>
<li><a href="#status-parameters">Status Parameters</a></li>
<li><a href="#comment-parameters">Comment Parameters</a></li>
<li><a href="#pagination-parameters">Pagination Parameters</a></li>
<li><a href="#order-orderby-parameters">Order &amp; Orderby Parameters</a></li>
<li><a href="#date-parameters">Date Parameters</a></li>
<li><a href="#custom-field-post-meta-parameters">Custom Field (post meta) Parameters</a></li>
<li><a href="#permission-parameters">Permission Parameters</a></li>
<li><a href="#mime-type-parameters">Mime Type Parameters</a></li>
<li><a href="#caching-parameters">Caching Parameters</a></li>
<li><a href="#return-fields-parameter">Return Fields Parameter</a>
</ul></li>
<li><a href="#methods">Methods</a></li>
<li><a href="#source">Source</a></li>
<li><a href="#changelog">Changelog</a></li>
<li><a href="#user-contributed-notes">User Contributed Notes</a></ul>
</div>

<p class="has-small-font-size is-link-to-top"><a href="#wp--skip-link--target"><span aria-hidden="true" class="wp-exclude-emoji">↑</span> Back to top</a></p></div>


				

				

				
<div class="entry-content wp-block-post-content is-layout-flow wp-container-core-post-content-is-layout-4479b7c2 wp-block-post-content-is-layout-flow">
		<section class="wp-block-wporg-code-reference-summary"><p>The WordPress Query class.</p>
</section>
		
		
		
		<section class="wporg-has-embedded-code wp-block-wporg-code-reference-explanation"><h2 id="more-information" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#more-information">More Information</a></h2> 
<p class="wp-block-paragraph">Most of the time you can find the information you want without actually dealing with the class internals and global variables. There are a whole bunch of functions that you can call from anywhere that will enable you to get the information you need.</p>



<p class="wp-block-paragraph">There are two main scenarios you might want to use <code>WP_Query</code> in. The first is to find out what type of request WordPress is currently dealing with. The <code>$is_*</code> properties are designed to hold this information: use the <a href="https://developer.wordpress.org/themes/basics/conditional-tags/">Conditional Tags</a> to interact here. This is the more common scenario to plugin writers (the second normally applies to theme writers).</p>



<p class="wp-block-paragraph">The second is during <a href="https://developer.wordpress.org/themes/basics/the-loop/">The Loop</a>. <code>WP_Query</code> provides numerous functions for common tasks within <a href="https://developer.wordpress.org/themes/basics/the-loop/">The Loop</a>. To begin with, <a href="https://developer.wordpress.org/reference/functions/have_posts/" rel="function">have_posts()</a> , which calls <code>$wp_query-&gt;have_posts()</code>, is called to see if there are any posts to show. If there are, a <code>while</code> loop is begun, using <a href="https://developer.wordpress.org/reference/functions/have_posts/" rel="function">have_posts()</a>  as the condition. This will iterate around as long as there are posts to show. In each iteration, <a href="https://developer.wordpress.org/reference/functions/the_post/" rel="function">the_post()</a> , which calls <code>$wp_query-&gt;the_post()</code> is called, setting up internal variables within <code>$wp_query</code> and the global <code>$post</code> variable (which the <a href="https://developer.wordpress.org/themes/basics/template-tags/">Template Tags</a> rely on), as above. These are the functions you should use when writing a theme file that needs a loop.</p>



<p class="wp-block-paragraph"><strong>Note:</strong> If you use <a href="https://developer.wordpress.org/reference/functions/the_post/" rel="function">the_post()</a>  with your query, you need to run <a href="https://developer.wordpress.org/reference/functions/wp_reset_postdata/" rel="function">wp_reset_postdata()</a>  afterwards to have template tags use the main query&#8217;s current post again.</p>



<p class="wp-block-paragraph"><strong>Note:</strong> <a href="https://core.trac.wordpress.org/ticket/18408">Ticket #18408</a> For querying posts in the admin, consider using <a href="https://developer.wordpress.org/reference/functions/get_posts/" rel="function">get_posts()</a>  as <a href="https://developer.wordpress.org/reference/functions/wp_reset_postdata/" rel="function">wp_reset_postdata()</a>  might not behave as expected.</p>



<h2 id="usage" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#usage">Usage</a></h2>



<h3 id="standard-loop" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#standard-loop">Standard Loop</a></h3>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers"><span class="pl-ent">&lt;?php</span></p>
<pre class="notranslate"><span class="pl-c">// The Query.</span>
<span class="pl-s1"><span class="pl-c1">$</span>the_query</span> = <span class="pl-k">new</span> <span class="pl-v">WP_Query</span>( <span class="pl-s1"><span class="pl-c1">$</span>args</span> );

<span class="pl-c">// The Loop.</span>
<span class="pl-k">if</span> ( <span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-&gt;<span class="pl-en">have_posts</span>() ) {
	<span class="pl-k">echo</span> <span class="pl-s">'&lt;ul&gt;'</span>;
	<span class="pl-k">while</span> ( <span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-&gt;<span class="pl-en">have_posts</span>() ) {
		<span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-&gt;<span class="pl-en">the_post</span>();
		<span class="pl-k">echo</span> <span class="pl-s">'&lt;li&gt;'</span> . esc_html( get_the_title() ) . <span class="pl-s">'&lt;/li&gt;'</span>;
	}
	<span class="pl-k">echo</span> <span class="pl-s">'&lt;/ul&gt;'</span>;
} <span class="pl-k">else</span> {
	esc_html_e( <span class="pl-s">'Sorry, no posts matched your criteria.'</span> );
}
<span class="pl-c">// Restore original Post Data.</span>
wp_reset_postdata();</pre>
<p></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="standard-loop-alternate" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#standard-loop-alternate">Standard Loop (Alternate)</a></h3>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers"><span class="pl-ent">&lt;?php</span></p>
<pre class="notranslate"><span class="pl-c">// the query.</span>
<span class="pl-s1"><span class="pl-c1">$</span>the_query</span> = <span class="pl-k">new</span> <span class="pl-v">WP_Query</span>( <span class="pl-s1"><span class="pl-c1">$</span>args</span> ); <span class="pl-ent">?&gt;</span>

<span class="pl-ent">&lt;?php</span> <span class="pl-k">if</span> ( <span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-&gt;<span class="pl-en">have_posts</span>() ) : <span class="pl-ent">?&gt;</span>
	<span class="pl-c">&lt;!-- pagination here --&gt;</span>

	<span class="pl-c">&lt;!-- the loop --&gt;</span>
	<span class="pl-ent">&lt;?php</span>
	<span class="pl-k">while</span> ( <span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-&gt;<span class="pl-en">have_posts</span>() ) :
		<span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-&gt;<span class="pl-en">the_post</span>();
		<span class="pl-ent">?&gt;</span>
		<span class="pl-ent">&lt;?php</span> the_title( '<span class="pl-kos">&lt;</span><span class="pl-ent">h2</span><span class="pl-kos">&gt;', '&lt;/<span class="pl-ent">h2</span>&gt;'</span> ); <span class="pl-ent">?&gt;</span>
	<span class="pl-ent">&lt;?php</span> <span class="pl-k">endwhile</span>; <span class="pl-ent">?&gt;</span>
	<span class="pl-c">&lt;!-- end of the loop --&gt;</span>

	<span class="pl-c">&lt;!-- pagination here --&gt;</span>

	<span class="pl-ent">&lt;?php</span> wp_reset_postdata(); <span class="pl-ent">?&gt;</span>

<span class="pl-ent">&lt;?php</span> <span class="pl-k">else</span> : <span class="pl-ent">?&gt;</span>
	<span class="pl-kos">&lt;</span><span class="pl-ent">p</span><span class="pl-kos">&gt;</span><span class="pl-ent">&lt;?php</span> esc_html_e( <span class="pl-s">'Sorry, no posts matched your criteria.'</span> ); <span class="pl-ent">?&gt;</span><span class="pl-kos">&lt;/</span><span class="pl-ent">p</span><span class="pl-kos">&gt;</span>
<span class="pl-ent">&lt;?php</span> <span class="pl-k">endif</span>; <span class="pl-ent">?&gt;</span></pre>
<p></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="multiple-loops" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#multiple-loops">Multiple Loops</a></h3>



<p class="wp-block-paragraph">If you have multiple queries, you need to perform multiple loops. Like so&#8230;<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">&lt;?php

// The Query
$query1 = new WP_Query( $args );

// The Loop
while ( $query1-&gt;have_posts() ) {
$query1-&gt;the_post();
echo '&lt;li&gt;' . get_the_title() . '&lt;/li&gt;';
}

/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset with
* wp_reset_query(). We just need to set the post data back up with
* wp_reset_postdata().
*/
wp_reset_postdata();

/* The 2nd Query (without global var) */
$query2 = new WP_Query( $args2 );

// The 2nd Loop
while ( $query2-&gt;have_posts() ) {
$query2-&gt;the_post();
echo '&lt;li&gt;' . get_the_title( $query2-&gt;post-&gt;ID ) . '&lt;/li&gt;';
}

// Restore original Post Data
wp_reset_postdata();

?&gt;</code></pre>



<h2 id="properties-and-methods" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#properties-and-methods">Properties and Methods</a></h2>



<p class="wp-block-paragraph">This is the formal documentation of <code>WP_Query</code>. You shouldn&#8217;t alter the properties directly, but instead use the <a href="#methods">methods (see methods list below)</a> to interact with them.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="properties" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#properties">Properties</a></h3>



<ul class="wp-block-list">
<li><code>$query</code><br>
Holds the query string that was passed to the <code>$wp_query</code> object by WP class.</li>



<li><code>$query_vars</code><br>
An associative array containing the dissected <code>$query</code>: an array of the query variables and their respective values.</li>



<li><code>$queried_object</code><br>
Applicable if the request is a category, author, permalink or Page. Holds information on the requested category, author, post or Page.</li>



<li><code>$queried_object_id</code><br>
If the request is a category, author, permalink or post / page, holds the corresponding ID.</li>



<li><code>$posts</code><br>
Gets filled with the requested posts from the database.</li>



<li><code>$post_count</code><br>
The number of posts being displayed.</li>



<li><code>$found_posts</code><br>
The total number of posts found matching the current query parameters</li>



<li><code>$max_num_pages</code><br>
The total number of pages. Is the result of $found_posts / $posts_per_page</li>



<li><code>$current_post</code><br>
(available during The Loop) Index of the post currently being displayed.</li>



<li><code>$post</code><br>
(available during The Loop) The post currently being displayed.</li>



<li><code>$is_single</code>, <code>$is_page</code>, <code>$is_archive</code>, <code>$is_preview</code>, <code>$is_date</code>, <code>$is_year</code>, <code>$is_month</code>, <code>$is_time</code>, <code>$is_author</code>, <code>$is_category</code>, <code>$is_tag</code>, <code>$is_tax</code>, <code>$is_search</code>, <code>$is_feed</code>, <code>$is_comment_feed</code>, <code>$is_trackback</code>, <code>$is_home</code>, <code>$is_404</code>, <code>$is_comments_popup</code>, <code>$is_admin</code>, <code>$is_attachment</code>, <code>$is_singular</code>, <code>$is_robots</code>, <code>$is_posts_page</code>, <code>$is_paged</code><br>
Booleans dictating what type of request this is. For example, the first three represent &#8216;is it a permalink?&#8217;, &#8216;is it a Page?&#8217;, &#8216;is it any type of archive page?&#8217;, respectively. See also <a href="https://developer.wordpress.org/themes/basics/conditional-tags/">Conditional Tags</a>.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 id="parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#parameters">Parameters</a></h2>



<h3 id="author-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#author-parameters">Author Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with certain author.</p>



<ul class="wp-block-list">
<li><strong><code>author</code></strong> (<em>int</em>) &#8211; use author id.</li>



<li><strong><code>author_name</code></strong> (<em>string</em>) &#8211; use &#8216;<code>user_nicename</code>&#8216; &#8211; NOT name.</li>



<li><strong><code>author__in</code></strong> (<em>array</em>) &#8211; use author id (available since version 3.7).</li>



<li><strong><code>author__not_in</code></strong> (<em>array</em>) &#8211; use author id (available since version 3.7).</li>
</ul>



<p class="wp-block-paragraph"><strong>Show Posts for one Author </strong></p>



<p class="wp-block-paragraph">Display posts by author, using author id:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'author' =&gt; 123 ) );</code></pre>



<p class="wp-block-paragraph">Display posts by author, using author &#8216;<code>user_nicename</code>&#8216;:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'author_name' =&gt; 'rami' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Show Posts From Several Authors</strong></p>



<p class="wp-block-paragraph">Display posts from several specific authors:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'author' =&gt; '2,6,17,38' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Exclude Posts Belonging to an Author</strong></p>



<p class="wp-block-paragraph">Display all posts <em>except</em> those from an author(singular) by prefixing its id with a &#8216;-&#8216; (minus) sign:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'author' =&gt; -12 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Multiple Author Handling</strong></p>



<p class="wp-block-paragraph">Display posts from multiple authors:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'author__in' =&gt; array( 2, 6 ) ) );</code></pre>



<p class="wp-block-paragraph">You can also exclude multiple author this way:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'author__not_in' =&gt; array( 2, 6 ) ) );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="category-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#category-parameters">Category Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with certain categories.</p>



<ul class="wp-block-list">
<li><strong><code>cat</code></strong> (<em>int</em>) &#8211; use category id.</li>



<li><strong><code>category_name</code></strong> (<em>string</em>) &#8211; use category slug.</li>



<li><strong><code>category__and</code></strong> (<em>array</em>) &#8211; use category id.</li>



<li><strong><code>category__in</code></strong> (<em>array</em>) &#8211; use category id.</li>



<li><strong><code>category__not_in</code></strong> (<em>array</em>) &#8211; use category id.</li>
</ul>



<p class="wp-block-paragraph"><strong>Display posts that have one category (and any children of that category), using category id:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'cat' =&gt; 4 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have this category (and any children of that category), using category slug:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category_name' =&gt; 'staff' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have this category (not children of that category), using category id:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category__in' =&gt; 4 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have several categories, using category id:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'cat' =&gt; '2,6,17,38' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have these categories, using category slug:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category_name' =&gt; 'staff,news' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have &#8220;all&#8221; of these categories:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category_name' =&gt; 'staff+news' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display all posts <em>except</em> those from a category by prefixing its id with a &#8216;-&#8216; (minus) sign.</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'cat' =&gt; '-12,-34,-56' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that are in multiple categories. This shows posts that are in both categories 2 and 6:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category__and' =&gt; array( 2, 6 ) ) );</code></pre>



<p class="wp-block-paragraph">To display posts from either category 2 OR 6, you could use <code>cat</code> as mentioned above, or by using <code>category__in</code> (note this does not show posts from any children of these categories):</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category__in' =&gt; array( 2, 6 ) ) );</code></pre>



<p class="wp-block-paragraph">You can also exclude multiple categories this way:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'category__not_in' =&gt; array( 2, 6 ) ) );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="tag-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#tag-parameters">Tag Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with certain tags.</p>



<ul class="wp-block-list">
<li><strong><code>tag</code></strong> (<em>string</em>) &#8211; use tag slug.</li>



<li><strong><code>tag_id</code></strong> (<em>int</em>) &#8211; use tag id.</li>



<li><strong><code>tag__and</code></strong> (<em>array</em>) &#8211; use tag ids.</li>



<li><strong><code>tag__in</code></strong> (<em>array</em>) &#8211; use tag ids.</li>



<li><strong><code>tag__not_in</code></strong> (<em>array</em>) &#8211; use tag ids.</li>



<li><strong><code>tag_slug__and</code></strong> (<em>array</em>) &#8211; use tag slugs.</li>



<li><strong><code>tag_slug__in</code></strong> (<em>array</em>) &#8211; use tag slugs.</li>
</ul>



<p class="wp-block-paragraph"><strong>Display posts that have one tag, using tag slug:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag' =&gt; 'cooking' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have this tag, using tag id:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag_id' =&gt; 13 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have &#8220;either&#8221; of these tags:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag' =&gt; 'bread,baking' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have &#8220;all&#8221; of these tags:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag' =&gt; 'bread+baking+recipe' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that are tagged with both tag id 37 and tag id 47:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag__and' =&gt; array( 37, 47 ) ) );</code></pre>



<p class="wp-block-paragraph">To display posts from either tag id 37 or 47, you could use <code>tag</code> as mentioned above, or explicitly specify by using <code>tag__in</code>:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag__in' =&gt; array( 37, 47 ) ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that do not have any of the two tag ids 37 and 47:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'tag__not_in' =&gt; array( 37, 47 ) ) );</code></pre>



<p class="wp-block-paragraph">The <code>tag_slug__in</code> and <code>tag_slug__and</code> behave much the same, except match against the tag&#8217;s slug.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="taxonomy-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#taxonomy-parameters">Taxonomy Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with certain taxonomy.</p>



<ul class="wp-block-list">
<li><strong><code>{tax}</code></strong> (<em>string</em>) &#8211; use taxonomy slug. (<strong>Deprecated</strong> since version 3.1 in favor of &#8216;<code>tax_query</code>&#8216;).</li>



<li><strong><code>tax_query</code></strong> (<em>array</em>) &#8211; use taxonomy parameters (available since version 3.1).
<ul class="wp-block-list">
<li><strong><code>relation</code></strong> (<em>string</em>) &#8211; The logical relationship between each inner taxonomy array when there is more than one. Possible values are &#8216;AND&#8217;, &#8216;OR&#8217;. Do not use with a single inner taxonomy array.
<ul class="wp-block-list">
<li><strong><code>taxonomy</code></strong> (<em>string</em>) &#8211; Taxonomy.</li>



<li><strong><code>field</code></strong> (<em>string</em>) &#8211; Select taxonomy term by. Possible values are &#8216;term_id&#8217;, &#8216;name&#8217;, &#8216;slug&#8217; or &#8216;term_taxonomy_id&#8217;. Default value is &#8216;term_id&#8217;.</li>



<li><strong><code>terms</code></strong> (<em>int/string/array</em>) &#8211; Taxonomy term(s).</li>



<li><strong><code>include_children</code></strong> (<em>boolean</em>) &#8211; Whether or not to include children for hierarchical taxonomies. Defaults to true.</li>



<li><strong><code>operator</code></strong> (<em>string</em>) &#8211; Operator to test. Possible values are &#8216;IN&#8217;, &#8216;NOT IN&#8217;, &#8216;AND&#8217;, &#8216;EXISTS&#8217; and &#8216;NOT EXISTS&#8217;. Default value is &#8216;IN&#8217;.</li>
</ul>
</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><strong>Important Note:</strong> <code>tax_query</code> takes an <strong>array</strong> of tax query arguments <strong>arrays</strong> (it takes an array of arrays).<br>
This construct allows you to query multiple taxonomies by using the <strong><code>relation</code></strong> parameter in the first (outer) array to describe the boolean relationship between the taxonomy arrays.</p>



<p class="wp-block-paragraph"><strong>Simple Taxonomy Query:</strong></p>



<p class="wp-block-paragraph">Display <strong>posts</strong> tagged with <strong>bob</strong>, under <strong>people</strong> custom taxonomy:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'post',
'tax_query' =&gt; array(
array(
'taxonomy' =&gt; 'people',
'field' =&gt; 'slug',
'terms' =&gt; 'bob',
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Multiple Taxonomy Handling:</strong></p>



<p class="wp-block-paragraph">Display <strong>posts</strong> from several custom taxonomies:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'post',
'tax_query' =&gt; array(
'relation' =&gt; 'AND',
array(
'taxonomy' =&gt; 'movie_genre',
'field' =&gt; 'slug',
'terms' =&gt; array( 'action', 'comedy' ),
),
array(
'taxonomy' =&gt; 'actor',
'field' =&gt; 'term_id',
'terms' =&gt; array( 103, 115, 206 ),
'operator' =&gt; 'NOT IN',
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Display <strong>posts</strong> that are in the <strong>quotes</strong> category OR have the <strong>quote</strong> post format:</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'post',
'tax_query' =&gt; array(
'relation' =&gt; 'OR',
array(
'taxonomy' =&gt; 'category',
'field' =&gt; 'slug',
'terms' =&gt; array( 'quotes' ),
),
array(
'taxonomy' =&gt; 'post_format',
'field' =&gt; 'slug',
'terms' =&gt; array( 'post-format-quote' ),
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Nested Taxonomy Handling:</strong></p>



<p class="wp-block-paragraph">The <code>'tax_query'</code> clauses can be nested, to create more complex queries. Example: Display <strong>posts</strong> that are in the <strong>quotes</strong> category OR both have the <strong>quote</strong> post format AND are in the <strong>wisdom</strong> category:</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'post',
'tax_query' =&gt; array(
'relation' =&gt; 'OR',
array(
'taxonomy' =&gt; 'category',
'field' =&gt; 'slug',
'terms' =&gt; array( 'quotes' ),
),
array(
'relation' =&gt; 'AND',
array(
'taxonomy' =&gt; 'post_format',
'field' =&gt; 'slug',
'terms' =&gt; array( 'post-format-quote' ),
),
array(
'taxonomy' =&gt; 'category',
'field' =&gt; 'slug',
'terms' =&gt; array( 'wisdom' ),
),
),
),
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="search-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#search-parameters">Search Parameters</a></h3>



<p class="wp-block-paragraph">Show posts based on a keyword search.</p>



<ul class="wp-block-list">
<li><strong><code>s</code></strong> (<em>string</em>) &#8211; Search keyword.</li>
</ul>



<p class="wp-block-paragraph"><strong>Show Posts based on a keyword search</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 's' =&gt; 'keyword' ) );</code></pre>



<p class="wp-block-paragraph">Prepending a term with a hyphen will exclude posts matching that term. Eg, <code>'pillow -sofa'</code> will return posts containing &#8216;pillow&#8217; but not &#8216;sofa&#8217; (available since Version 4.4).</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="post-page-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#post-page-parameters">Post &amp; Page Parameters</a></h3>



<p class="wp-block-paragraph">Display content based on post and page parameters. Remember that default <code>post_type</code> is only set to display posts but not pages.</p>



<ul class="wp-block-list">
<li><strong><code>p</code></strong> (<em>int</em>) &#8211; use post id.</li>



<li><strong><code>name</code></strong> (<em>string</em>) &#8211; use post slug.</li>



<li><strong><code>page_id</code></strong> (<em>int</em>) &#8211; use page id.</li>



<li><strong><code>pagename</code></strong> (<em>string</em>) &#8211; use page slug.</li>



<li><strong><code>post_parent</code></strong> (<em>int</em>) &#8211; use page id to return only child pages. Set to 0 to return only top-level entries.</li>



<li><strong><code>post_parent__in</code></strong> (<em>array</em>) &#8211; use post ids. Specify posts whose parent is in an array (available since version 3.6).</li>



<li><strong><code>post_parent__not_in</code></strong> (<em>array</em>) &#8211; use post ids. Specify posts whose parent is not in an array (available since version 3.6).</li>



<li><strong><code>post__in</code></strong> (<em>array</em>) &#8211; use post ids. Specify posts to retrieve. <strong>ATTENTION</strong> If you use sticky posts, they will be included (prepended!) in the posts you retrieve whether you want it or not. To suppress this behaviour use <code>ignore_sticky_posts</code>.</li>



<li><strong><code>post__not_in</code></strong> (<em>array</em>) &#8211; use post ids. Specify post NOT to retrieve.</li>



<li><strong><code>post_name__in</code></strong> (<em>array</em>) &#8211; use post slugs. Specify posts to retrieve (available since version 4.4).</li>



<li><code><strong>title</strong></code> (string) – use DB field <code>post_title</code>. Must be an exact match. Specify posts to retrieve (available since version 4.4).</li>
</ul>



<p class="wp-block-paragraph"><strong>NOTE:</strong> <a href="https://core.trac.wordpress.org/ticket/28099">Ticket #28099</a>: Passing an empty array to <code>post__in</code> will return <code>has_posts()</code> as true (and all posts will be returned). Logic should be used before hand to determine if <code>WP_Query</code> should be used in the event that the array being passed to <code>post__in</code> is empty.</p>



<p class="wp-block-paragraph"><strong>Display post by ID:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'p' =&gt; 7 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display page by ID:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'page_id' =&gt; 7 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Show post/page by slug</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'name' =&gt; 'about-my-life' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display page by <code>slug</code>:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'pagename' =&gt; 'contact' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts by title:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'title' =&gt; 'Hello World!' ) );</code></pre>



<p class="wp-block-paragraph">Note: the title must be an <strong>exact</strong> match.</p>



<p class="wp-block-paragraph"><strong>Display child page using the slug of the parent and the child page, separated by a slash (e.g. &#8216;parent_slug/child_slug&#8217;):</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'pagename' =&gt; 'contact_us/canada' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display child pages using parent page ID:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_parent' =&gt; 93 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display only top-level pages, exclude all child pages:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_parent' =&gt; 0 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts whose parent is in an array:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_parent__in' =&gt; array( 2, 5, 12, 14, 20 ) ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display only the specific posts:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_type' =&gt; 'page', 'post__in' =&gt; array( 2, 5, 12, 14, 20 ) ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display all posts but NOT the specified ones:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_type' =&gt; 'post', 'post__not_in' =&gt; array( 2, 5, 12, 14, 20 ) ) );</code></pre>



<p class="wp-block-paragraph"><strong>Note:</strong> you cannot combine <code>post__in</code> and <code>post__not_in</code> in the same query.</p>



<p class="wp-block-paragraph">Also note that using a string containing a comma separated list will not work here. If you&#8217;re passing a variable, make sure it&#8217;s a proper array of integer values:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">// This will NOT work
$exclude_ids = '1,2,3';
$query = new WP_Query( array( 'post__not_in' =&gt; array( $exclude_ids ) ) );

// This WILL work
$exclude_ids = array( 1, 2, 3 );
$query = new WP_Query( array( 'post__not_in' =&gt; $exclude_ids ) );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="password-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#password-parameters">Password Parameters</a></h3>



<p class="wp-block-paragraph">Show content based on post and page parameters. Remember that default <code>post_type</code> is only set to display posts but not pages.</p>



<ul class="wp-block-list">
<li><strong><code>has_password</code></strong> (<em>bool</em>) &#8211; true for posts with passwords ; false for posts without passwords ; null for all posts with and without passwords (available since version 3.9).</li>



<li><strong><code>post_password</code></strong> (<em>string</em>) &#8211; show posts with a particular password (available since version 3.9)</li>
</ul>



<p class="wp-block-paragraph"><strong>Display only password protected posts:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'has_password' =&gt; true ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display only posts without passwords:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'has_password' =&gt; false ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display only posts with and without passwords:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'has_password' =&gt; null ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts with a particular password:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_password' =&gt; 'zxcvbn' ) );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="post-type-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#post-type-parameters">Post Type Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with certain <a href="https://developer.wordpress.org/themes/basics/post-types/">type</a>.</p>



<ul class="wp-block-list">
<li><strong><code>post_type</code></strong> (<em>string</em> / <em>array</em>) &#8211; use post types. Retrieves posts by post types, default value is &#8216;<code>post</code>&#8216;. If &#8216;<code>tax_query</code>&#8216; is set for a query, the default value becomes &#8216;<code>any</code>&#8216;;
<ul class="wp-block-list">
<li>&#8216;<code>post</code>&#8216; &#8211; a post.</li>



<li>&#8216;<code>page</code>&#8216; &#8211; a page.</li>



<li>&#8216;<code>revision</code>&#8216; &#8211; a revision.</li>



<li>&#8216;<code>attachment</code>&#8216; &#8211; an attachment. Whilst the default <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a> <code>post_status</code> is &#8216;publish&#8217;, attachments have a default <code>post_status</code> of &#8216;inherit&#8217;. This means no attachments will be returned unless you also explicitly set <code>post_status</code> to &#8216;inherit&#8217; or &#8216;any&#8217;. See <a href="#status-parameters">Status parameters</a> section below.</li>



<li>&#8216;<code>nav_menu_item</code>&#8216; &#8211; a navigation menu item</li>



<li>&#8216;<code>any</code>&#8216; &#8211; retrieves any type except revisions and types with &#8216;exclude_from_search&#8217; set to true.<br>
** Custom Post Types (e.g. movies)</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><strong>Display only pages:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_type' =&gt; 'page' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display &#8216;<code>any</code>&#8216; post type (retrieves any type except revisions and types with &#8216;exclude_from_search&#8217; set to TRUE):</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_type' =&gt; 'any' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display multiple post types, including custom post types:</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$args = array(
'post_type' =&gt; array( 'post', 'page', 'movie', 'book' )
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="status-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#status-parameters">Status Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with certain <a href="https://wordpress.org/support/article/post-status/">post status</a>.</p>



<ul class="wp-block-list">
<li><strong><code>post_status</code></strong> (<em>string</em> / <em>array</em>) &#8211; use post status. Retrieves posts by post status. Default value is &#8216;<code>publish</code>&#8216;, but if the user is logged in, &#8216;<code>private</code>&#8216; is added. Public <a href="https://wordpress.org/support/article/post-status/#custom-status">custom post statuses</a> are also included by default. And if the query is run in an admin context (administration area or AJAX call), protected statuses are added too. By default protected statuses are &#8216;<code>future</code>&#8216;, &#8216;<code>draft</code>&#8216; and &#8216;<code>pending</code>&#8216;.
<ul class="wp-block-list">
<li>&#8216;<code>publish</code>&#8216; &#8211; a published post or page.</li>



<li>&#8216;<code>pending</code>&#8216; &#8211; post is pending review.</li>



<li>&#8216;<code>draft</code>&#8216; &#8211; a post in draft status.</li>



<li>&#8216;<code>auto-draft</code>&#8216; &#8211; a newly created post, with no content.</li>



<li>&#8216;<code>future</code>&#8216; &#8211; a post to publish in the future.</li>



<li>&#8216;<code>private</code>&#8216; &#8211; not visible to users who are not logged in.</li>



<li>&#8216;<code>inherit</code>&#8216; &#8211; a revision. see <a href="https://developer.wordpress.org/reference/functions/get_children/" rel="function">get_children()</a> .</li>



<li>&#8216;<code>trash</code>&#8216; &#8211; post is in trashbin (available since version 2.9).</li>



<li>&#8216;<code>any</code>&#8216; &#8211; retrieves any status except for &#8216;inherit&#8217;, &#8216;trash&#8217; and &#8216;auto-draft&#8217;. Custom post statuses with &#8216;exclude_from_search&#8217; set to true are also excluded.</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><strong>Display only posts with the &#8216;<code>draft</code>&#8216; status:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post_status' =&gt; 'draft' ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display multiple post status:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$args = array(
'post_status' =&gt; array( 'pending', 'draft', 'future' )
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display all attachments:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_status' =&gt; 'any',
'post_type' =&gt; 'attachment'
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="comment-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#comment-parameters">Comment Parameters</a></h3>



<p class="wp-block-paragraph">Since Version 4.9 Introduced the `$comment_count` parameter. It can be either an Integer or an Array.</p>



<ul class="wp-block-list">
<li><strong><code>comment_count</code></strong> (<em>int</em>) &#8211; The amount of comments your CPT has to have ( Search operator will do a &#8216;=&#8217; operation )</li>



<li><strong><code>comment_count</code></strong> (<em>Array</em>) &#8211; If comment_count is an array, it should have two arguments:
<ul class="wp-block-list">
<li>&#8216;<code>value</code>&#8216; &#8211; The amount of comments your post has to have when comparing</li>



<li>&#8216;<code>compare</code>&#8216; &#8211; The search operator. Possible values are &#8216;=&#8217;, &#8216;!=&#8217;, &#8216;&gt;&#8217;, &#8216;&gt;=&#8217;, &#8216;&lt;&#8216;, &#8216;&lt;=&#8217;. Default value is &#8216;=&#8217;.</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><strong>Display posts with 20 comments: </strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'post',
'comment_count' =&gt; 20,
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts with 25 comments or more:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'post',
'comment_count' =&gt; array(
'value' =&gt; 25,
'compare' =&gt; '&gt;=',
)
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="pagination-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#pagination-parameters">Pagination Parameters</a></h3>



<ul class="wp-block-list">
<li><strong><code>nopaging</code></strong> (<em>boolean</em>) &#8211; show all posts or use pagination. Default value is &#8216;false&#8217;, use paging.</li>



<li><strong><code>posts_per_page</code></strong> (<em>int</em>) &#8211; number of post to show per page (available since version 2.1, replaced <strong><code>showposts</code></strong> parameter). Use <code>'posts_per_page'=&gt;-1</code> to show all posts (the <code>'offset'</code> parameter is ignored with a <code>-1</code> value). Set the &#8216;paged&#8217; parameter if pagination is off after using this parameter. <em>Note</em>: if the query is in a feed, wordpress overwrites this parameter with the stored &#8216;posts_per_rss&#8217; option. To reimpose the limit, try using the ‘<code>post_limits</code>’ filter, or filter ‘<code>pre_option_posts_per_rss</code>’ and return a very large number (if you want to return all posts) such as PHP constant <code>PHP_INT_MAX</code> so that on most cases all entries are outputted.</li>



<li><strong><code>posts_per_archive_page</code></strong> (<em>int</em>) &#8211; number of posts to show per page &#8211; on archive pages only. Over-rides <strong><code>posts_per_page</code></strong> and <strong><code>showposts</code></strong> on pages where <a href="https://developer.wordpress.org/reference/functions/is_archive/" rel="function">is_archive()</a>  or <a href="https://developer.wordpress.org/reference/functions/is_search/" rel="function">is_search()</a>  would be true.</li>



<li><strong><code>offset</code></strong> (<em>int</em>) &#8211; number of post to <em>displace</em> or pass over. <em>Warning</em>: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination. The <code>'offset'</code> parameter is ignored when <code>'posts_per_page'=&gt;-1</code> (show all posts) is used.</li>



<li><strong><code>paged</code></strong> (<em>int</em>) &#8211; number of page. Show the posts that would normally show up just on page X when using the &#8220;Older Entries&#8221; link.</li>



<li><strong><code>page</code></strong> (<em>int</em>) &#8211; number of page for a static front page. Show the posts that would normally show up just on page X of a Static Front Page.</li>



<li><strong><code>ignore_sticky_posts</code></strong> (<em>boolean</em>) &#8211; ignore post stickiness (available since version 3.1, replaced <strong><code>caller_get_posts</code></strong> parameter). <code>false</code> (default): move sticky posts to the start of the set. <code>true</code>: do not move sticky posts to the start of the set.</li>
</ul>



<p class="wp-block-paragraph"><strong>Display x posts per page:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'posts_per_page' =&gt; 3 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display all posts in one page:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'posts_per_page' =&gt; -1 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display all posts by disabling pagination:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'nopaging' =&gt; true ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts from the 4th one:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'offset' =&gt; 3 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display 5 posts per page which follow the 3 most recent posts:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'posts_per_page' =&gt; 5, 'offset' =&gt; 3 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts from page number x:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'paged' =&gt; 6 ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts from current page:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'paged' =&gt; get_query_var( 'paged' ) ) );</code></pre>



<p class="wp-block-paragraph"><span id="set-paged">Display posts from the current page and set the &#8216;paged&#8217; parameter to 1 when the query variable is not set (first page).</span></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$query = new WP_Query( array( 'paged' =&gt; $paged ) );</code></pre>



<p class="wp-block-paragraph">Pagination Note: Use <code>get_query_var('page');</code> if you want your query to work in a <a href="https://developer.wordpress.org/themes/template-files-section/page-template-files/">page template</a> that you&#8217;ve set as your <a href="https://wordpress.org/support/article/creating-a-static-front-page/">static front page</a>. The query variable &#8216;page&#8217; also holds the pagenumber for a single paginated Post or Page that includes the <code>&lt;!--nextpage--&gt;</code> quicktag in the post content.</p>



<p class="wp-block-paragraph"><strong>Display posts from current page on a <a href="https://wordpress.org/support/article/creating-a-static-front-page/">static front page</a>:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
$query = new WP_Query( array( 'paged' =&gt; $paged ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display just the first sticky post:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$sticky = get_option( 'sticky_posts' );
$query = new WP_Query( array( 'p' =&gt; $sticky[0] ) );</code></pre>



<p class="wp-block-paragraph"><strong>Display just the first sticky post, if none return the last post published:</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'posts_per_page' =&gt; 1,
'post__in' =&gt; get_option( 'sticky_posts' ),
'ignore_sticky_posts' =&gt; 1,
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display just the first sticky post, if none return nothing:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$sticky = get_option( 'sticky_posts' );
$args = array(
'posts_per_page' =&gt; 1,
'post__in' =&gt; $sticky,
'ignore_sticky_posts' =&gt; 1,
);
$query = new WP_Query( $args );
if ( $sticky[0] ) {
// insert here your stuff...
}</code></pre>



<p class="wp-block-paragraph"><strong>Exclude all sticky posts from the query:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'post__not_in' =&gt; get_option( 'sticky_posts' ) ) );</code></pre>



<p class="wp-block-paragraph"><strong>Exclude sticky posts from a category:</strong></p>



<p class="wp-block-paragraph">Return ALL posts within the category, but don&#8217;t show sticky posts at the top. The &#8216;sticky posts&#8217; will still show in their natural position (e.g. by date):</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'ignore_sticky_posts' =&gt; 1, 'posts_per_page' =&gt; 3, 'cat' =&gt; 6 );</code></pre>



<p class="wp-block-paragraph"><strong>Exclude sticky posts from a category:</strong></p>



<p class="wp-block-paragraph">Return posts within the category, but exclude sticky posts completely, and adhere to paging rules:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$sticky = get_option( 'sticky_posts' );
$args = array(
'cat' =&gt; 3,
'ignore_sticky_posts' =&gt; 1,
'post__not_in' =&gt; $sticky,
'paged' =&gt; $paged,
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="order-orderby-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#order-orderby-parameters">Order &amp; Orderby Parameters</a></h3>



<p class="wp-block-paragraph">Sort retrieved posts.</p>



<ul class="wp-block-list">
<li><strong><code>order</code></strong> (<em>string | array</em>) &#8211; Designates the ascending or descending order of the &#8216;<code>orderby</code>&#8216; parameter. Defaults to &#8216;DESC&#8217;. An array can be used for multiple order/orderby sets.
<ul class="wp-block-list">
<li>&#8216;<code>ASC</code>&#8216; &#8211; ascending order from lowest to highest values (1, 2, 3; a, b, c).</li>



<li>&#8216;<code>DESC</code>&#8216; &#8211; descending order from highest to lowest values (3, 2, 1; c, b, a).</li>
</ul>
</li>



<li><strong><code>orderby</code></strong> (<em>string | array</em>) &#8211; Sort retrieved posts by parameter. Defaults to &#8216;date (post_date)&#8217;. One or more options can be passed.
<ul class="wp-block-list">
<li>&#8216;<code>none</code>&#8216; &#8211; No order (available since version 2.8).</li>



<li>&#8216;<code>ID</code>&#8216; &#8211; Order by post id. Note the capitalization.</li>



<li>&#8216;<code>author</code>&#8216; &#8211; Order by author.</li>



<li>&#8216;<code>title</code>&#8216; &#8211; Order by title.</li>



<li>&#8216;<code>name</code>&#8216; &#8211; Order by post name (post slug).</li>



<li>&#8216;<code>type</code>&#8216; &#8211; Order by post type (available since version 4.0).</li>



<li>&#8216;<code>date</code>&#8216; &#8211; Order by date.</li>



<li>&#8216;<code>modified</code>&#8216; &#8211; Order by last modified date.</li>



<li>&#8216;<code>parent</code>&#8216; &#8211; Order by post/page parent id.</li>



<li>&#8216;<code>rand</code>&#8216; &#8211; Random order.</li>



<li>&#8216;<code>comment_count</code>&#8216; &#8211; Order by number of comments (available since version 2.9).</li>



<li>&#8216;<code>relevance</code>&#8216; &#8211; Order by search terms in the following order: First, whether the entire sentence is matched. Second, if all the search terms are within the titles. Third, if any of the search terms appear in the titles. And, fourth, if the full sentence appears in the contents.</li>



<li>&#8216;<code>menu_order</code>&#8216; &#8211; Order by Page Order. Used most often for pages (<em>Order</em> field in the Edit Page Attributes box) and for attachments (the integer fields in the Insert / Upload Media Gallery dialog), but could be used for any post type with distinct &#8216;<code>menu_order</code>&#8216; values (they all default to <var>0</var>).</li>



<li>&#8216;<code>meta_value</code>&#8216; &#8211; Note that a &#8216;<code>meta_key=keyname</code>&#8216; must also be present in the query. Note also that the sorting will be alphabetical which is fine for strings (i.e. words), but can be unexpected for numbers (e.g. 1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, 56 as you might naturally expect). Use &#8216;<code>meta_value_num</code>&#8216; instead for numeric values. You may also specify &#8216;<code>meta_type</code>&#8216; if you want to cast the meta value as a specific type. Possible values are &#8216;NUMERIC&#8217;, &#8216;BINARY&#8217;, &#8216;CHAR&#8217;, &#8216;DATE&#8217;, &#8216;DATETIME&#8217;, &#8216;DECIMAL&#8217;, &#8216;SIGNED&#8217;, &#8216;TIME&#8217;, &#8216;UNSIGNED&#8217;, same as in &#8216;<code>$meta_query</code>&#8216;.</li>



<li>&#8216;<code>meta_value_num</code>&#8216; &#8211; Order by numeric meta value (available since version 2.8). Also note that a &#8216;<code>meta_key=keyname</code>&#8216; must also be present in the query. This value allows for numerical sorting as noted above in &#8216;<code>meta_value</code>&#8216;.</li>



<li>&#8216;<code>post__in</code>&#8216; &#8211; Preserve post ID order given in the post__in array (available since version 3.5). Note &#8211; the value of the order parameter does not change the resulting sort order.</li>



<li>&#8216;<code>post_name__in</code>&#8216; &#8211; Preserve post slug order given in the &#8216;post_name__in&#8217; array (available since Version 4.6). Note &#8211; the value of the order parameter does not change the resulting sort order.</li>



<li>&#8216;<code>post_parent__in</code>&#8216; -Preserve post parent order given in the &#8216;post_parent__in&#8217; array (available since Version 4.6). Note &#8211; the value of the order parameter does not change the resulting sort order.</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><strong>Display posts sorted by post &#8216;title&#8217; in a descending order:</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'orderby' =&gt; 'title',
'order' =&gt; 'DESC',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts sorted by &#8216;menu_order&#8217; with a fallback to post &#8216;title&#8217;, in a descending order:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'orderby' =&gt; 'menu_order title',
'order' =&gt; 'DESC',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display one random post:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'orderby' =&gt; 'rand',
'posts_per_page' =&gt; '1',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts ordered by comment count (popularity):</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$args = array(
'orderby' =&gt; 'comment_count'
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts with &#8216;Product&#8217; type ordered by &#8216;Price&#8217; custom field:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'product',
'orderby' =&gt; 'meta_value_num',
'meta_key' =&gt; 'price',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display pages ordered by &#8216;title&#8217; and &#8216;menu_order&#8217;. (title is dominant):</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'page',
'orderby' =&gt; 'title menu_order',
'order' =&gt; 'ASC',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display pages ordered by &#8216;title&#8217; and &#8216;menu_order&#8217; with different sort orders (ASC/DESC) (available since version 4.0):</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$args = array(
'orderby' =&gt; array( 'title' =&gt; 'DESC', 'menu_order' =&gt; 'ASC' )
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Related article: <a href="https://make.wordpress.org/core/2014/08/29/a-more-powerful-order-by-in-wordpress-4-0/">A more powerful ORDER BY in WordPress 4.0</a>.</p>



<p class="wp-block-paragraph"><strong>Mulitiple orderby/order pairs</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'orderby' =&gt; array( 'meta_value_num' =&gt; 'DESC', 'title' =&gt; 'ASC' ),
'meta_key' =&gt; 'age'
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>&#8216;orderby&#8217; with &#8216;meta_value&#8217; and custom post type</strong></p>



<p class="wp-block-paragraph">Display posts of type &#8216;my_custom_post_type&#8217;, ordered by &#8216;age&#8217;, and filtered to show only ages 3 and 4 (using meta_query).<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'my_custom_post_type',
'meta_key' =&gt; 'age',
'orderby' =&gt; 'meta_value_num',
'order' =&gt; 'ASC',
'meta_query' =&gt; array(
array(
'key' =&gt; 'age',
'value' =&gt; array( 3, 4 ),
'compare' =&gt; 'IN',
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>&#8216;orderby&#8217; with multiple &#8216;meta_key&#8217;s</strong></p>



<p class="wp-block-paragraph">If you wish to order by two different pieces of postmeta (for example, City first and State second), you need to combine and link your meta query to your orderby array using &#8216;named meta queries&#8217;. See the example below:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$q = new WP_Query( array(
'meta_query' =&gt; array(
'relation' =&gt; 'AND',
'state_clause' =&gt; array(
'key' =&gt; 'state',
'value' =&gt; 'Wisconsin',
),
'city_clause' =&gt; array(
'key' =&gt; 'city',
'compare' =&gt; 'EXISTS',
),
),
'orderby' =&gt; array(
'city_clause' =&gt; 'ASC',
'state_clause' =&gt; 'DESC',
),
) );</code></pre>



<p class="wp-block-paragraph">
(props to cybmeta on WPSE for <a href="http://wordpress.stackexchange.com/a/246358/3687">this example</a>).</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="date-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#date-parameters">Date Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with a certain time and date period.</p>



<ul class="wp-block-list">
<li><strong><code>year</code></strong> (<em>int</em>) &#8211; 4 digit year (e.g. 2011).</li>



<li><strong><code>monthnum</code></strong> (<em>int</em>) &#8211; Month number (from 1 to 12).</li>



<li><strong><code>w</code></strong> (<em>int</em>) &#8211; Week of the year (from 0 to 53). Uses <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_week">MySQL WEEK command</a>. The mode is dependent on the &#8220;start_of_week&#8221; option.</li>



<li><strong><code>day</code></strong> (<em>int</em>) &#8211; Day of the month (from 1 to 31).</li>



<li><strong><code>hour</code></strong> (<em>int</em>) &#8211; Hour (from 0 to 23).</li>



<li><strong><code>minute</code></strong> (<em>int</em>) &#8211; Minute (from 0 to 60).</li>



<li><strong><code>second</code></strong> (<em>int</em>) &#8211; Second (0 to 60).</li>



<li><strong><code>m</code></strong> (<em>int</em>) &#8211; YearMonth (For e.g.: <strong><code>201307</code></strong>).</li>



<li><strong><code>date_query</code></strong> (<em>array</em>) &#8211; Date parameters (available since version 3.7).
<ul class="wp-block-list">
<li><strong><code>year</code></strong> (<em>int</em>) &#8211; 4 digit year (e.g. 2011).</li>



<li><strong><code>month</code></strong> (<em>int</em>) &#8211; Month number (from 1 to 12).</li>



<li><strong><code>week</code></strong> (<em>int</em>) &#8211; Week of the year (from 0 to 53).</li>



<li><strong><code>day</code></strong> (<em>int</em>) &#8211; Day of the month (from 1 to 31).</li>



<li><strong><code>hour</code></strong> (<em>int</em>) &#8211; Hour (from 0 to 23).</li>



<li><strong><code>minute</code></strong> (<em>int</em>) &#8211; Minute (from 0 to 59).</li>



<li><strong><code>second</code></strong> (<em>int</em>) &#8211; Second (0 to 59).</li>



<li><strong><code>after</code></strong> (<em>string/array</em>) &#8211; Date to retrieve posts after. Accepts <code><a href="http://php.net/strtotime">strtotime()</a></code>-compatible string, or array of &#8216;year&#8217;, &#8216;month&#8217;, &#8216;day&#8217; values:
<ul class="wp-block-list">
<li><strong><code>year</code></strong> (<em>string</em>) Accepts any four-digit year. Default is empty.</li>



<li><strong><code>month</code></strong> (<em>string</em>) The month of the year. Accepts numbers 1-12. Default: 12.</li>



<li><strong><code>day</code></strong> (<em>string</em>) The day of the month. Accepts numbers 1-31. Default: last day of month.</li>
</ul>
</li>



<li><strong><code>before</code></strong> (<em>string/array</em>) &#8211; Date to retrieve posts before. Accepts <code><a href="http://php.net/strtotime">strtotime()</a></code>-compatible string, or array of &#8216;year&#8217;, &#8216;month&#8217;, &#8216;day&#8217; values:
<ul class="wp-block-list">
<li><strong><code>year</code></strong> (<em>string</em>) Accepts any four-digit year. Default is empty.</li>



<li><strong><code>month</code></strong> (<em>string</em>) The month of the year. Accepts numbers 1-12. Default: 1.</li>



<li><strong><code>day</code></strong> (<em>string</em>) The day of the month. Accepts numbers 1-31. Default: 1.</li>
</ul>
</li>



<li><strong><code>inclusive</code></strong> (<em>boolean</em>) &#8211; When true, includes the boundary dates in results by using &gt;= and and &lt; operators. Only works with Y-m-d format strings or array format; human-readable strings like &#8220;January 1st, 2025&#8221; bypass the rounding logic. Default: false.</li>



<li><strong><code>compare</code></strong> (<em>string</em>) &#8211; See <a href="https://developer.wordpress.org/reference/classes/wp_date_query/get_compare/" rel="method">WP_Date_Query::get_compare()</a>.</li>



<li><strong><code>column</code></strong> (<em>string</em>) &#8211; Posts column to query against. Default: &#8216;post_date&#8217;.</li>



<li><strong><code>relation</code></strong> (<em>string</em>) &#8211; OR or AND, how the sub-arrays should be compared. Default: AND.</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><strong>Returns posts dated December 12, 2012:</strong></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( 'year=2012&amp;monthnum=12&amp;day=12' );</code></pre>



<p class="wp-block-paragraph">or:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'date_query' =&gt; array(
array(
'year' =&gt; 2012,
'month' =&gt; 12,
'day' =&gt; 12,
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Returns posts for today:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$today = getdate();
$query = new WP_Query( 'year=' . $today['year'] . '&amp;monthnum=' . $today['mon'] . '&amp;day=' . $today['mday'] );</code></pre>



<p class="wp-block-paragraph">or:</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$today = getdate();
$args = array(
'date_query' =&gt; array(
array(
'year' =&gt; $today['year'],
'month' =&gt; $today['mon'],
'day' =&gt; $today['mday'],
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Returns posts for this week:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$week = date( 'W' );
$year = date( 'Y' );
$query = new WP_Query( 'year=' . $year . '&amp;w=' . $week );</code></pre>



<p class="wp-block-paragraph">
or:<br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'date_query' =&gt; array(
array(
'year' =&gt; date( 'Y' ),
'week' =&gt; date( 'W' ),
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Return posts between 9AM to 5PM on weekdays</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'date_query' =&gt; array(
array(
'hour' =&gt; 9,
'compare' =&gt; '&gt;=',
),
array(
'hour' =&gt; 17,
'compare' =&gt; '&lt;=',
),
array(
'dayofweek' =&gt; array( 2, 6 ),
'compare' =&gt; 'BETWEEN',
),
),
'posts_per_page' =&gt; -1,
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Return posts from January 1st to February 28th</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'date_query' =&gt; array(
array(
'after' =&gt; 'January 1st, 2013',
'before' =&gt; array(
'year' =&gt; 2013,
'month' =&gt; 2,
'day' =&gt; 28,
),
'inclusive' =&gt; true,
),
),
'posts_per_page' =&gt; -1,
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Note that if a <code><a href="http://php.net/strtotime">strtotime()</a></code>-compatible string with just a date was passed in the <code>before</code> parameter, this will be converted to 00:00:00 on that date. In this case, even if <code>inclusive</code> was set to true, the date would not be included in the query. If you want a before date to be inclusive, include the time as well, such as <code>'before' =&gt; '2013-02-28 23:59:59'</code>, or use the array format, which is adjusted automatically if <code>inclusive</code> is set.</p>



<p class="wp-block-paragraph"><strong>Return posts made over a year ago but modified in the past month</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'date_query' =&gt; array(
array(
'column' =&gt; 'post_date_gmt',
'before' =&gt; '1 year ago',
),
array(
'column' =&gt; 'post_modified_gmt',
'after' =&gt; '1 month ago',
),
),
'posts_per_page' =&gt; -1,
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
The <code>'date_query'</code> clauses can be nested, in order to construct complex queries. See <a href="#taxonomy-parameters">Taxonomy Parameters</a> for details on the syntax.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="custom-field-post-meta-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#custom-field-post-meta-parameters">Custom Field (post meta) Parameters</a></h3>



<p class="wp-block-paragraph">Show posts associated with a certain custom field.</p>



<p class="wp-block-paragraph">This part of the query is parsed by <a href="https://developer.wordpress.org/reference/classes/wp_meta_query/" rel="class">WP_Meta_Query</a>, so check the docs for it as well in case this list of arguments isn&#8217;t up to date.</p>



<ul class="wp-block-list">
<li><strong><code>meta_key</code></strong> (<em>string</em>) &#8211; Custom field key.</li>



<li><strong><code>meta_value</code></strong> (<em>string</em>) &#8211; Custom field value.</li>



<li><strong><code>meta_compare</code></strong> (<em>string</em>) &#8211; Operator to test the &#8216;<code>meta_value</code>&#8216;. Possible values are &#8216;=&#8217;, &#8216;!=&#8217;, &#8216;&gt;&#8217;, &#8216;&gt;=&#8217;, &#8216;&lt;&#8216;, &#8216;&lt;=&#8217;, &#8216;LIKE&#8217;, &#8216;NOT LIKE&#8217;, &#8216;IN&#8217;, &#8216;NOT IN&#8217;, &#8216;BETWEEN&#8217;, &#8216;NOT BETWEEN&#8217;, &#8216;NOT EXISTS&#8217;, &#8216;REGEXP&#8217;, &#8216;NOT REGEXP&#8217; or &#8216;RLIKE&#8217;. Default value is &#8216;=&#8217;.</li>



<li><strong><code>meta_query</code></strong> (<em>array</em>) &#8211; Custom field parameters (available since version 3.1).
<ul class="wp-block-list">
<li><strong><code>relation</code></strong> (<em>string</em>) &#8211; The logical relationship between each inner meta_query array when there is more than one. Possible values are &#8216;AND&#8217;, &#8216;OR&#8217;. Do not use with a single inner meta_query array.</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph"><code>meta_query</code> also contains one or more arrays with the following keys:</p>



<ul class="wp-block-list">
<li><strong><code>key</code></strong> (<em>string</em>) &#8211; Custom field key.</li>



<li><strong><code>value</code></strong> (<em>string</em>|<em>array</em>) &#8211; Custom field value. It can be an array only when <code><strong>compare</strong></code> is <code>'IN'</code>, <code>'NOT IN'</code>, <code>'BETWEEN'</code>, or <code>'NOT BETWEEN'</code>. You don&#8217;t have to specify a value when using the <code>'EXISTS'</code> or <code>'NOT EXISTS'</code> comparisons in WordPress 3.9 and up.<br>
(<strong>Note:</strong> Due to <a href="https://core.trac.wordpress.org/ticket/23268">bug #23268</a>, <code>value</code> is required for <code>NOT EXISTS</code> comparisons to work correctly prior to 3.9. You must supply <em>some</em> string for the <code>value</code> parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your SQL when using <code>NOT EXISTS</code>. Need inspiration? How about <code>'bug #23268'</code>.)</li>



<li><strong><code>compare</code></strong> (<em>string</em>) &#8211; Operator to test. Possible values are &#8216;=&#8217;, &#8216;!=&#8217;, &#8216;&gt;&#8217;, &#8216;&gt;=&#8217;, &#8216;&lt;&#8216;, &#8216;&lt;=&#8217;, &#8216;LIKE&#8217;, &#8216;NOT LIKE&#8217;, &#8216;IN&#8217;, &#8216;NOT IN&#8217;, &#8216;BETWEEN&#8217;, &#8216;NOT BETWEEN&#8217;, &#8216;EXISTS&#8217; and &#8216;NOT EXISTS&#8217;. Default value is &#8216;=&#8217;.</li>



<li><strong><code>type</code></strong> (<em>string</em>) &#8211; Custom field type. Possible values are &#8216;NUMERIC&#8217;, &#8216;BINARY&#8217;, &#8216;CHAR&#8217;, &#8216;DATE&#8217;, &#8216;DATETIME&#8217;, &#8216;DECIMAL&#8217;, &#8216;SIGNED&#8217;, &#8216;TIME&#8217;, &#8216;UNSIGNED&#8217;. Default value is &#8216;CHAR&#8217;.</li>
</ul>



<p class="wp-block-paragraph">The &#8216;type&#8217; DATE works with the &#8216;compare&#8217; value BETWEEN only if the date is stored at the format YYYY-MM-DD and tested with this format.</p>



<p class="wp-block-paragraph"><strong>Important Note:</strong> <code>meta_query</code> takes an <strong>array</strong> of meta query arguments <strong>arrays</strong> (it takes an array of arrays) &#8211; you can see this in the examples below.<br>
This construct allows you to query multiple metadatas by using the <strong><code>relation</code></strong> parameter in the first (outer) array to describe the boolean relationship between the meta queries. Accepted arguments are &#8216;AND&#8217;, &#8216;OR&#8217;. The default is &#8216;AND&#8217;.</p>



<p class="wp-block-paragraph"><strong>Simple Custom Field Query:</strong></p>



<p class="wp-block-paragraph">Display posts where the custom field key is &#8216;color&#8217;, regardless of the custom field value:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'meta_key' =&gt; 'color' ) );</code></pre>



<p class="wp-block-paragraph">Display posts where the custom field value is &#8216;blue&#8217;, regardless of the custom field key:</p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array( 'meta_value' =&gt; 'blue' ) );</code></pre>



<p class="wp-block-paragraph">Display page where the custom field value is &#8216;blue&#8217;, regardless of the custom field key:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'meta_value' =&gt; 'blue',
'post_type' =&gt; 'page'
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Display posts where the custom field key is &#8216;color&#8217; and the custom field value is &#8216;blue&#8217;:<br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'meta_key' =&gt; 'color',
'meta_value' =&gt; 'blue'
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Display posts where the custom field key is &#8216;color&#8217; and the custom field value IS NOT &#8216;blue&#8217;:<br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'meta_key' =&gt; 'color',
'meta_value' =&gt; 'blue',
'meta_compare' =&gt; '!='
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Display posts where the custom field key is a set date and the custom field value is now. Displays only posts which date has not passed.<br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'event',
'meta_key' =&gt; 'event_date',
'meta_value' =&gt; date( "Ymd" ), // change to how "event date" is stored
'meta_compare' =&gt; '&gt;',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">Display &#8216;product'(s) where the custom field key is &#8216;price&#8217; and the custom field value that is LESS THAN OR EQUAL TO 22.<br><em>By using the &#8216;meta_value&#8217; parameter the value 99 will be considered greater than 100 as the data are stored as strings, not numbers. For number comparison use the &#8216;meta_type&#8217; argument.</em><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'meta_key' =&gt; 'price',
'meta_value' =&gt; '22',
'meta_compare' =&gt; '&lt;=',
'post_type' =&gt; 'product'
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
Display posts with a custom field value of zero (0), regardless of the custom field key:<br></p>


<pre class="wp-block-code"><code lang="php" class="language-php ">$args = array(
'meta_value' =&gt; '_wp_zero_value'
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts from a single custom field:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'product',
'meta_query' =&gt; array(
array(
'key' =&gt; 'color',
'value' =&gt; 'blue',
'compare' =&gt; 'NOT LIKE',
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
(Note that meta_query expects nested arrays, even if you only have one query.)</p>



<p class="wp-block-paragraph"><strong>Display posts from several custom fields:</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'product',
'meta_query' =&gt; array(
array(
'key' =&gt; 'color',
'value' =&gt; 'blue',
'compare' =&gt; 'NOT LIKE',
),
array(
'key' =&gt; 'price',
'value' =&gt; array( 20, 100 ),
'type' =&gt; 'numeric',
'compare' =&gt; 'BETWEEN',
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Display posts that have meta key &#8216;color&#8217; NOT LIKE value &#8216;blue&#8217; OR meta key &#8216;price&#8217; with values BETWEEN 20 and 100:</strong><br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'product',
'meta_query' =&gt; array(
'relation' =&gt; 'OR',
array(
'key' =&gt; 'color',
'value' =&gt; 'blue',
'compare' =&gt; 'NOT LIKE',
),
array(
'key' =&gt; 'price',
'value' =&gt; array( 20, 100 ),
'type' =&gt; 'numeric',
'compare' =&gt; 'BETWEEN',
),
),
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
The <code>'meta_query'</code> clauses can be nested in order to construct complex queries. For example, show productss where <strong>color=orange</strong> OR <strong>color=red&amp;size=small</strong> translates to the following:<br></p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'product',
'meta_query' =&gt; array(
'relation' =&gt; 'OR',
array(
'key' =&gt; 'color',
'value' =&gt; 'orange',
'compare' =&gt; '=',
),
array(
'relation' =&gt; 'AND',
array(
'key' =&gt; 'color',
'value' =&gt; 'red',
'compare' =&gt; '=',
),
array(
'key' =&gt; 'size',
'value' =&gt; 'small',
'compare' =&gt; '=',
),
),
),
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="permission-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#permission-parameters">Permission Parameters</a></h3>



<p class="wp-block-paragraph">Show posts if user has the appropriate capability</p>



<ul class="wp-block-list">
<li><strong><code>perm</code></strong> (<em>string</em>) &#8211; User permission.</li>
</ul>



<p class="wp-block-paragraph"><strong>Display published and private posts, if the user has the appropriate capability:</strong><br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_status' =&gt; array( 'publish', 'private' ),
'perm' =&gt; 'readable',
);
$query = new WP_Query( $args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="mime-type-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#mime-type-parameters">Mime Type Parameters</a></h3>



<p class="wp-block-paragraph">Used with the attachments post type.</p>



<ul class="wp-block-list">
<li><strong><code>post_mime_type</code></strong> (<em>string/array</em>) &#8211; Allowed mime types.</li>
</ul>



<p class="wp-block-paragraph"><strong>Get attachments that are <em>gif</em> images:</strong></p>



<p class="wp-block-paragraph">Get gif images and remember that by default the attachment&#8217;s post_status is set to <strong>inherit</strong>.<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'post_type' =&gt; 'attachment',
'post_status' =&gt; 'inherit',
'post_mime_type' =&gt; 'image/gif',
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Get attachments that are not images:</strong></p>



<p class="wp-block-paragraph">To exclude certain mime types you first need to get all mime types using <a href="https://developer.wordpress.org/reference/functions/get_allowed_mime_types/" rel="function">get_allowed_mime_types()</a>  and run a difference between arrays of what you want and the allowed mime types with <code><a href="http://php.net/manual/en/function.array-diff.php">array_diff()</a></code>.<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$unsupported_mimes = array( 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/tiff', 'image/x-icon' );
$all_mimes = get_allowed_mime_types();
$accepted_mimes = array_diff( $all_mimes, $unsupported_mimes );
$args = array(
'post_type' =&gt; 'attachment',
'post_status' =&gt; 'inherit',
'post_mime_type' =&gt; $accepted_mimes,
);
$query = new WP_Query( $query_args );</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="caching-parameters" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#caching-parameters">Caching Parameters</a></h3>



<p class="wp-block-paragraph">Stop the data retrieved from being added to the cache.</p>



<ul class="wp-block-list">
<li><strong><code>cache_results</code></strong> (<em>boolean</em>) &#8211; Post information cache.</li>



<li><strong><code>update_post_meta_cache</code></strong> (<em>boolean</em>) &#8211; Post meta information cache.</li>



<li><strong><code>update_post_term_cache</code></strong> (<em>boolean</em>) &#8211; Post term information cache.</li>
</ul>



<p class="wp-block-paragraph"><strong>Show Posts without adding post information to the cache</strong></p>



<p class="wp-block-paragraph">Display 50 posts, but don&#8217;t add post information to the cache:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'posts_per_page' =&gt; 50,
'cache_results' =&gt; false
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Show Posts without adding post meta information to the cache</strong></p>



<p class="wp-block-paragraph">Display 50 posts, but don&#8217;t add post meta information to the cache:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'posts_per_page' =&gt; 50,
'update_post_meta_cache' =&gt; false
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph"><strong>Show Posts without adding post term information to the cache</strong></p>



<p class="wp-block-paragraph">Display 50 posts, but don&#8217;t add post term information to the cache:<br>
</p>


<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
'posts_per_page' =&gt; 50,
'update_post_term_cache' =&gt; false
);
$query = new WP_Query( $args );</code></pre>



<p class="wp-block-paragraph">
In general usage you should not need to use these, adding to the cache is the right thing to do, however they may be useful in specific circumstances. An example of such circumstances might be when using a <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a> to retrieve a list of post titles and URLs to be displayed, but in which no other information about the post will be used and the taxonomy and meta data won&#8217;t be needed. By not loading this information, you can save time from the extra unnecessary SQL queries.</p>



<p class="wp-block-paragraph"><strong>Note</strong>: If a persistent object cache backend (such as memcached) is used, these flags are set to false by default since there is no need to update the cache every page load when a persistent cache exists.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 id="return-fields-parameter" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#return-fields-parameter">Return Fields Parameter</a></h3>



<p class="wp-block-paragraph">Set return values.</p>



<ul class="wp-block-list">
<li><strong><code>fields</code></strong> (<em>string</em>) &#8211; Which fields to return. There are three options:
<ul class="wp-block-list">
<li><strong><code>'all'</code></strong> &#8211; Return all fields (default).</li>



<li><strong><code>'ids'</code></strong> &#8211; Return an array of post IDs.</li>



<li><strong><code>'id=&gt;parent'</code></strong> &#8211; Return an array of stdClass objects with ID and post_parent properties.</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph">Passing anything else will return all fields (default) &#8211; an array of post objects.</p>
</section>
		<section class="wp-block-wporg-code-reference-methods"><h2 id="methods" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#methods">Methods</a></h2> <section style="margin-top:var(--wp--preset--spacing--20)" class="wp-block-wporg-code-table" id="uses"><figure class="wp-block-table "><table><thead><tr><th scope="col">Name</th><th scope="col">Description</th></tr></thead><tbody><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/__call/">WP_Query::__call</a></td><td>Makes private/protected methods readable for backward compatibility.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/__construct/">WP_Query::__construct</a></td><td>Constructor.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/__get/">WP_Query::__get</a></td><td>Makes private properties readable for backward compatibility.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/__isset/">WP_Query::__isset</a></td><td>Makes private properties checkable for backward compatibility.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/fill_query_vars/">WP_Query::fill_query_vars</a></td><td>Fills in the query variables, which do not exist within the parameter.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/generate_cache_key/">WP_Query::generate_cache_key</a></td><td>Generates cache key.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/generate_postdata/">WP_Query::generate_postdata</a></td><td>Generates post data.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/get/">WP_Query::get</a></td><td>Retrieves the value of a query variable.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/get_posts/">WP_Query::get_posts</a></td><td>Retrieves an array of posts based on query variables.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/get_queried_object/">WP_Query::get_queried_object</a></td><td>Retrieves the currently queried object.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/get_queried_object_id/">WP_Query::get_queried_object_id</a></td><td>Retrieves the ID of the currently queried object.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/">WP_Query::get_search_stopwords</a></td><td>Retrieves stopwords used when parsing search terms.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/have_comments/">WP_Query::have_comments</a></td><td>Determines whether there are more comments available.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/have_posts/">WP_Query::have_posts</a></td><td>Determines whether there are more posts available in the loop.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/init/">WP_Query::init</a></td><td>Initiates object properties and sets default values.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/init_query_flags/">WP_Query::init_query_flags</a></td><td>Resets query flags to false.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_404/">WP_Query::is_404</a></td><td>Determines whether the query is a 404 (returns no results).</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_archive/">WP_Query::is_archive</a></td><td>Determines whether the query is for an existing archive page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_attachment/">WP_Query::is_attachment</a></td><td>Determines whether the query is for an existing attachment page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_author/">WP_Query::is_author</a></td><td>Determines whether the query is for an existing author archive page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_category/">WP_Query::is_category</a></td><td>Determines whether the query is for an existing category archive page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_comment_feed/">WP_Query::is_comment_feed</a></td><td>Determines whether the query is for a comments feed.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_comments_popup/">WP_Query::is_comments_popup</a></td><td>Determines whether the current URL is within the comments popup window. — <span class="deprecated-method">deprecated</span></td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_date/">WP_Query::is_date</a></td><td>Determines whether the query is for an existing date archive.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_day/">WP_Query::is_day</a></td><td>Determines whether the query is for an existing day archive.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_embed/">WP_Query::is_embed</a></td><td>Determines whether the query is for an embedded post.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_favicon/">WP_Query::is_favicon</a></td><td>Determines whether the query is for the favicon.ico file.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_feed/">WP_Query::is_feed</a></td><td>Determines whether the query is for a feed.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_front_page/">WP_Query::is_front_page</a></td><td>Determines whether the query is for the front page of the site.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_home/">WP_Query::is_home</a></td><td>Determines whether the query is for the blog homepage.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_main_query/">WP_Query::is_main_query</a></td><td>Determines whether the query is the main query.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_month/">WP_Query::is_month</a></td><td>Determines whether the query is for an existing month archive.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_page/">WP_Query::is_page</a></td><td>Determines whether the query is for an existing single page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_paged/">WP_Query::is_paged</a></td><td>Determines whether the query is for a paged result and not for the first page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_post_type_archive/">WP_Query::is_post_type_archive</a></td><td>Determines whether the query is for an existing post type archive page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_preview/">WP_Query::is_preview</a></td><td>Determines whether the query is for a post or page preview.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_privacy_policy/">WP_Query::is_privacy_policy</a></td><td>Determines whether the query is for the Privacy Policy page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_robots/">WP_Query::is_robots</a></td><td>Determines whether the query is for the robots.txt file.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_search/">WP_Query::is_search</a></td><td>Determines whether the query is for a search.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_single/">WP_Query::is_single</a></td><td>Determines whether the query is for an existing single post.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_singular/">WP_Query::is_singular</a></td><td>Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_sitemap/">WP_Query::is_sitemap</a></td><td>Determines whether the query is for a sitemap.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_tag/">WP_Query::is_tag</a></td><td>Determines whether the query is for an existing tag archive page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_tax/">WP_Query::is_tax</a></td><td>Determines whether the query is for an existing custom taxonomy archive page.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_time/">WP_Query::is_time</a></td><td>Determines whether the query is for a specific time.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_trackback/">WP_Query::is_trackback</a></td><td>Determines whether the query is for a trackback endpoint call.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/is_year/">WP_Query::is_year</a></td><td>Determines whether the query is for an existing year archive.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/lazyload_comment_meta/">WP_Query::lazyload_comment_meta</a></td><td>Lazyloads comment meta for comments in the loop. — <span class="deprecated-method">deprecated</span></td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/lazyload_term_meta/">WP_Query::lazyload_term_meta</a></td><td>Lazyloads term meta for posts in the loop. — <span class="deprecated-method">deprecated</span></td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/next_comment/">WP_Query::next_comment</a></td><td>Iterates current comment index and returns <a href="https://developer.wordpress.org/reference/classes/wp_comment/" rel="class">WP_Comment</a> object.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/next_post/">WP_Query::next_post</a></td><td>Sets up the next post and iterate current post index.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_order/">WP_Query::parse_order</a></td><td>Parse an &#8216;order&#8217; query variable and cast it to ASC or DESC as necessary.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_orderby/">WP_Query::parse_orderby</a></td><td>Converts the given orderby alias (if allowed) to a properly-prefixed value.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_query/">WP_Query::parse_query</a></td><td>Parses a query string and sets query type booleans.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_query_vars/">WP_Query::parse_query_vars</a></td><td>Reparses the query vars.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_search/">WP_Query::parse_search</a></td><td>Generates SQL for the WHERE clause based on passed search terms.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_search_order/">WP_Query::parse_search_order</a></td><td>Generates SQL for the ORDER BY condition based on passed search terms.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_search_terms/">WP_Query::parse_search_terms</a></td><td>Checks if the terms are suitable for searching.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/parse_tax_query/">WP_Query::parse_tax_query</a></td><td>Parses various taxonomy related query vars.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/query/">WP_Query::query</a></td><td>Sets up the WordPress query by parsing query string.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/reset_postdata/">WP_Query::reset_postdata</a></td><td>After looping through a nested query, this function restores the $post global to the current post in this query.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/">WP_Query::rewind_comments</a></td><td>Rewinds the comments, resets the comment index and comment to first.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/rewind_posts/">WP_Query::rewind_posts</a></td><td>Rewinds the posts and resets post index.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/set/">WP_Query::set</a></td><td>Sets the value of a query variable.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/set_404/">WP_Query::set_404</a></td><td>Sets the 404 property and saves whether query is feed.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/set_found_posts/">WP_Query::set_found_posts</a></td><td>Sets up the amount of found posts and the number of pages (if limit clause was used) for the current query.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/setup_postdata/">WP_Query::setup_postdata</a></td><td>Sets up global post data.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/the_comment/">WP_Query::the_comment</a></td><td>Sets up the current comment.</td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/classes/wp_query/the_post/">WP_Query::the_post</a></td><td>Sets up the current post.</td></tr></tbody></table></figure></section> </section>
		<section class="wp-block-wporg-code-reference-source"><h2 id="source" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#source">Source</a></h2> <pre class="wp-block-code" data-start="18" aria-label="Function source code"><code id="wporg-source-code" lang="php" class="language-php line-numbers">#[AllowDynamicProperties]
class WP_Query {

	/**
	 * Query vars set by the user.
	 *
	 * @since 1.5.0
	 * @var ?array
	 */
	public $query;

	/**
	 * Query vars, after parsing.
	 *
	 * @since 1.5.0
	 * @var array
	 */
	public $query_vars = array();

	/**
	 * Taxonomy query, as passed to get_tax_sql().
	 *
	 * @since 3.1.0
	 * @var WP_Tax_Query|null A taxonomy query instance.
	 */
	public $tax_query;

	/**
	 * Metadata query container.
	 *
	 * @since 3.2.0
	 * @var WP_Meta_Query A meta query instance.
	 */
	public $meta_query = false;

	/**
	 * Date query container.
	 *
	 * @since 3.7.0
	 * @var WP_Date_Query A date query instance.
	 */
	public $date_query = false;

	/**
	 * Holds the data for a single object that is queried.
	 *
	 * Holds the contents of a post, page, category, attachment.
	 *
	 * @since 1.5.0
	 * @var WP_Term|WP_Post_Type|WP_Post|WP_User|null
	 */
	public $queried_object;

	/**
	 * The ID of the queried object.
	 *
	 * @since 1.5.0
	 * @var ?int
	 */
	public $queried_object_id;

	/**
	 * SQL for the database query.
	 *
	 * @since 2.0.1
	 * @var ?string
	 */
	public $request;

	/**
	 * Array of post objects or post IDs.
	 *
	 * @since 1.5.0
	 * @var WP_Post[]|int[]|null
	 */
	public $posts;

	/**
	 * The number of posts for the current query.
	 *
	 * @since 1.5.0
	 * @var int
	 */
	public $post_count = 0;

	/**
	 * Index of the current item in the loop.
	 *
	 * @since 1.5.0
	 * @var int
	 */
	public $current_post = -1;

	/**
	 * Whether the caller is before the loop.
	 *
	 * @since 6.3.0
	 * @var bool
	 */
	public $before_loop = true;

	/**
	 * Whether the loop has started and the caller is in the loop.
	 *
	 * @since 2.0.0
	 * @var bool
	 */
	public $in_the_loop = false;

	/**
	 * The current post.
	 *
	 * This property does not get populated when the `fields` argument is set to
	 * `ids` or `id=&gt;parent`.
	 *
	 * @since 1.5.0
	 * @var WP_Post|null
	 */
	public $post;

	/**
	 * The list of comments for current post.
	 *
	 * @since 2.2.0
	 * @var ?WP_Comment[]
	 */
	public $comments;

	/**
	 * The number of comments for the posts.
	 *
	 * @since 2.2.0
	 * @var int
	 */
	public $comment_count = 0;

	/**
	 * The index of the comment in the comment loop.
	 *
	 * @since 2.2.0
	 * @var int
	 */
	public $current_comment = -1;

	/**
	 * Current comment object.
	 *
	 * @since 2.2.0
	 * @var ?WP_Comment
	 */
	public $comment;

	/**
	 * The number of found posts for the current query.
	 *
	 * If limit clause was not used, equals $post_count.
	 *
	 * @since 2.1.0
	 * @var int
	 */
	public $found_posts = 0;

	/**
	 * The number of pages.
	 *
	 * @since 2.1.0
	 * @var int
	 */
	public $max_num_pages = 0;

	/**
	 * The number of comment pages.
	 *
	 * @since 2.7.0
	 * @var int
	 */
	public $max_num_comment_pages = 0;

	/**
	 * Signifies whether the current query is for a single post.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_single = false;

	/**
	 * Signifies whether the current query is for a preview.
	 *
	 * @since 2.0.0
	 * @var bool
	 */
	public $is_preview = false;

	/**
	 * Signifies whether the current query is for a page.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_page = false;

	/**
	 * Signifies whether the current query is for an archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_archive = false;

	/**
	 * Signifies whether the current query is for a date archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_date = false;

	/**
	 * Signifies whether the current query is for a year archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_year = false;

	/**
	 * Signifies whether the current query is for a month archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_month = false;

	/**
	 * Signifies whether the current query is for a day archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_day = false;

	/**
	 * Signifies whether the current query is for a specific time.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_time = false;

	/**
	 * Signifies whether the current query is for an author archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_author = false;

	/**
	 * Signifies whether the current query is for a category archive.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_category = false;

	/**
	 * Signifies whether the current query is for a tag archive.
	 *
	 * @since 2.3.0
	 * @var bool
	 */
	public $is_tag = false;

	/**
	 * Signifies whether the current query is for a taxonomy archive.
	 *
	 * @since 2.5.0
	 * @var bool
	 */
	public $is_tax = false;

	/**
	 * Signifies whether the current query is for a search.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_search = false;

	/**
	 * Signifies whether the current query is for a feed.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_feed = false;

	/**
	 * Signifies whether the current query is for a comment feed.
	 *
	 * @since 2.2.0
	 * @var bool
	 */
	public $is_comment_feed = false;

	/**
	 * Signifies whether the current query is for trackback endpoint call.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_trackback = false;

	/**
	 * Signifies whether the current query is for the site homepage.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_home = false;

	/**
	 * Signifies whether the current query is for the Privacy Policy page.
	 *
	 * @since 5.2.0
	 * @var bool
	 */
	public $is_privacy_policy = false;

	/**
	 * Signifies whether the current query couldn&#039;t find anything.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_404 = false;

	/**
	 * Signifies whether the current query is for an embed.
	 *
	 * @since 4.4.0
	 * @var bool
	 */
	public $is_embed = false;

	/**
	 * Signifies whether the current query is for a paged result and not for the first page.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_paged = false;

	/**
	 * Signifies whether the current query is for an administrative interface page.
	 *
	 * @since 1.5.0
	 * @var bool
	 */
	public $is_admin = false;

	/**
	 * Signifies whether the current query is for an attachment page.
	 *
	 * @since 2.0.0
	 * @var bool
	 */
	public $is_attachment = false;

	/**
	 * Signifies whether the current query is for an existing single post of any post type
	 * (post, attachment, page, custom post types).
	 *
	 * @since 2.1.0
	 * @var bool
	 */
	public $is_singular = false;

	/**
	 * Signifies whether the current query is for the robots.txt file.
	 *
	 * @since 2.1.0
	 * @var bool
	 */
	public $is_robots = false;

	/**
	 * Signifies whether the current query is for the favicon.ico file.
	 *
	 * @since 5.4.0
	 * @var bool
	 */
	public $is_favicon = false;

	/**
	 * Signifies whether the current query is for a sitemap.
	 *
	 * @since 7.1.0
	 */
	public bool $is_sitemap = false;

	/**
	 * Signifies whether the current query is for the page_for_posts page.
	 *
	 * Basically, the homepage if the option isn&#039;t set for the static homepage.
	 *
	 * @since 2.1.0
	 * @var bool
	 */
	public $is_posts_page = false;

	/**
	 * Signifies whether the current query is for a post type archive.
	 *
	 * @since 3.1.0
	 * @var bool
	 */
	public $is_post_type_archive = false;

	/**
	 * Stores the -&gt;query_vars state like md5(serialize( $this-&gt;query_vars ) ) so we know
	 * whether we have to re-parse because something has changed
	 *
	 * @since 3.1.0
	 * @var bool|string
	 */
	private $query_vars_hash = false;

	/**
	 * Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made
	 * via pre_get_posts hooks.
	 *
	 * @since 3.1.1
	 * @var bool
	 */
	private $query_vars_changed = true;

	/**
	 * Set if post thumbnails are cached
	 *
	 * @since 3.2.0
	 * @var bool
	 */
	public $thumbnails_cached = false;

	/**
	 * Controls whether an attachment query should include filenames or not.
	 *
	 * @since 6.0.3
	 * @var bool
	 */
	protected $allow_query_attachment_by_filename = false;

	/**
	 * Cached list of search stopwords.
	 *
	 * @since 3.7.0
	 * @var ?array
	 */
	private $stopwords;

	private $compat_fields = array( &#039;query_vars_hash&#039;, &#039;query_vars_changed&#039; );

	private $compat_methods = array( &#039;init_query_flags&#039;, &#039;parse_tax_query&#039; );

	/**
	 * The cache key generated by the query.
	 *
	 * The cache key is generated by the method ::generate_cache_key() after the
	 * query has been normalized.
	 *
	 * @since 6.8.0
	 * @var string
	 */
	private $query_cache_key = &#039;&#039;;

	/**
	 * Resets query flags to false.
	 *
	 * The query flags are what page info WordPress was able to figure out.
	 *
	 * @since 2.0.0
	 */
	private function init_query_flags() {
		$this-&gt;is_single            = false;
		$this-&gt;is_preview           = false;
		$this-&gt;is_page              = false;
		$this-&gt;is_archive           = false;
		$this-&gt;is_date              = false;
		$this-&gt;is_year              = false;
		$this-&gt;is_month             = false;
		$this-&gt;is_day               = false;
		$this-&gt;is_time              = false;
		$this-&gt;is_author            = false;
		$this-&gt;is_category          = false;
		$this-&gt;is_tag               = false;
		$this-&gt;is_tax               = false;
		$this-&gt;is_search            = false;
		$this-&gt;is_feed              = false;
		$this-&gt;is_comment_feed      = false;
		$this-&gt;is_trackback         = false;
		$this-&gt;is_home              = false;
		$this-&gt;is_privacy_policy    = false;
		$this-&gt;is_404               = false;
		$this-&gt;is_paged             = false;
		$this-&gt;is_admin             = false;
		$this-&gt;is_attachment        = false;
		$this-&gt;is_singular          = false;
		$this-&gt;is_robots            = false;
		$this-&gt;is_favicon           = false;
		$this-&gt;is_sitemap           = false;
		$this-&gt;is_posts_page        = false;
		$this-&gt;is_post_type_archive = false;
	}

	/**
	 * Initiates object properties and sets default values.
	 *
	 * @since 1.5.0
	 */
	public function init() {
		unset( $this-&gt;posts );
		unset( $this-&gt;query );
		$this-&gt;query_vars = array();
		unset( $this-&gt;queried_object );
		unset( $this-&gt;queried_object_id );
		$this-&gt;post_count   = 0;
		$this-&gt;current_post = -1;
		$this-&gt;in_the_loop  = false;
		$this-&gt;before_loop  = true;
		unset( $this-&gt;request );
		unset( $this-&gt;post );
		unset( $this-&gt;comments );
		unset( $this-&gt;comment );
		$this-&gt;comment_count         = 0;
		$this-&gt;current_comment       = -1;
		$this-&gt;found_posts           = 0;
		$this-&gt;max_num_pages         = 0;
		$this-&gt;max_num_comment_pages = 0;

		$this-&gt;init_query_flags();
	}

	/**
	 * Reparses the query vars.
	 *
	 * @since 1.5.0
	 */
	public function parse_query_vars() {
		$this-&gt;parse_query();
	}

	/**
	 * Fills in the query variables, which do not exist within the parameter.
	 *
	 * @since 2.1.0
	 * @since 4.5.0 Removed the `comments_popup` public query variable.
	 *
	 * @param array $query_vars Defined query variables.
	 * @return array Complete query variables with undefined ones filled in empty.
	 */
	public function fill_query_vars( $query_vars ) {
		$keys = array(
			&#039;error&#039;,
			&#039;m&#039;,
			&#039;p&#039;,
			&#039;post_parent&#039;,
			&#039;subpost&#039;,
			&#039;subpost_id&#039;,
			&#039;attachment&#039;,
			&#039;attachment_id&#039;,
			&#039;name&#039;,
			&#039;pagename&#039;,
			&#039;page_id&#039;,
			&#039;second&#039;,
			&#039;minute&#039;,
			&#039;hour&#039;,
			&#039;day&#039;,
			&#039;monthnum&#039;,
			&#039;year&#039;,
			&#039;w&#039;,
			&#039;category_name&#039;,
			&#039;tag&#039;,
			&#039;cat&#039;,
			&#039;tag_id&#039;,
			&#039;author&#039;,
			&#039;author_name&#039;,
			&#039;feed&#039;,
			&#039;tb&#039;,
			&#039;paged&#039;,
			&#039;meta_key&#039;,
			&#039;meta_value&#039;,
			&#039;preview&#039;,
			&#039;s&#039;,
			&#039;sentence&#039;,
			&#039;title&#039;,
			&#039;fields&#039;,
			&#039;menu_order&#039;,
			&#039;embed&#039;,
		);

		foreach ( $keys as $key ) {
			if ( ! isset( $query_vars[ $key ] ) ) {
				$query_vars[ $key ] = &#039;&#039;;
			}
		}

		$array_keys = array(
			&#039;category__in&#039;,
			&#039;category__not_in&#039;,
			&#039;category__and&#039;,
			&#039;post__in&#039;,
			&#039;post__not_in&#039;,
			&#039;post_name__in&#039;,
			&#039;tag__in&#039;,
			&#039;tag__not_in&#039;,
			&#039;tag__and&#039;,
			&#039;tag_slug__in&#039;,
			&#039;tag_slug__and&#039;,
			&#039;post_parent__in&#039;,
			&#039;post_parent__not_in&#039;,
			&#039;author__in&#039;,
			&#039;author__not_in&#039;,
			&#039;search_columns&#039;,
		);

		foreach ( $array_keys as $key ) {
			if ( ! isset( $query_vars[ $key ] ) ) {
				$query_vars[ $key ] = array();
			}
		}

		return $query_vars;
	}

	/**
	 * Parses a query string and sets query type booleans.
	 *
	 * @since 1.5.0
	 * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause&#039;s
	 *              array key to `$orderby`.
	 * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters. `$s` was updated to support excluded
	 *              search terms, by prepending a hyphen.
	 * @since 4.5.0 Removed the `$comments_popup` parameter.
	 *              Introduced the `$comment_status` and `$ping_status` parameters.
	 *              Introduced `RAND(x)` syntax for `$orderby`, which allows an integer seed value to random sorts.
	 * @since 4.6.0 Added &#039;post_name__in&#039; support for `$orderby`. Introduced the `$lazy_load_term_meta` argument.
	 * @since 4.9.0 Introduced the `$comment_count` parameter.
	 * @since 5.1.0 Introduced the `$meta_compare_key` parameter.
	 * @since 5.3.0 Introduced the `$meta_type_key` parameter.
	 * @since 6.1.0 Introduced the `$update_menu_item_cache` parameter.
	 * @since 6.2.0 Introduced the `$search_columns` parameter.
	 *
	 * @param string|array $query {
	 *     Optional. Array or string of Query parameters.
	 *
	 *     @type int             $attachment_id          Attachment post ID. Used for &#039;attachment&#039; post_type.
	 *     @type int|string      $author                 Author ID, or comma-separated list of IDs.
	 *     @type string          $author_name            User &#039;user_nicename&#039;.
	 *     @type int[]           $author__in             An array of author IDs to query from.
	 *     @type int[]           $author__not_in         An array of author IDs not to query from.
	 *     @type bool            $cache_results          Whether to cache post information. Default true.
	 *     @type int|string      $cat                    Category ID or comma-separated list of IDs (this or any children).
	 *     @type int[]           $category__and          An array of category IDs (AND in).
	 *     @type int[]           $category__in           An array of category IDs (OR in, no children).
	 *     @type int[]           $category__not_in       An array of category IDs (NOT in).
	 *     @type string          $category_name          Use category slug (not name, this or any children).
	 *     @type array|int       $comment_count          Filter results by comment count. Provide an integer to match
	 *                                                   comment count exactly. Provide an array with integer &#039;value&#039;
	 *                                                   and &#039;compare&#039; operator (&#039;=&#039;, &#039;!=&#039;, &#039;&gt;&#039;, &#039;&gt;=&#039;, &#039;&lt;&#039;, &#039;&lt;=&#039; ) to
	 *                                                   compare against comment_count in a specific way.
	 *     @type string          $comment_status         Comment status.
	 *     @type int             $comments_per_page      The number of comments to return per page.
	 *                                                   Default &#039;comments_per_page&#039; option.
	 *     @type array           $date_query             An associative array of WP_Date_Query arguments.
	 *                                                   See WP_Date_Query::__construct().
	 *     @type int             $day                    Day of the month. Default empty. Accepts numbers 1-31.
	 *     @type bool            $exact                  Whether to search by exact keyword. Default false.
	 *     @type string          $fields                 Post fields to query for. Accepts:
	 *                                                   - &#039;&#039; Returns an array of complete post objects (`WP_Post[]`).
	 *                                                   - &#039;ids&#039; Returns an array of post IDs (`int[]`).
	 *                                                   - &#039;id=&gt;parent&#039; Returns an associative array of parent post IDs,
	 *                                                     keyed by post ID (`int[]`).
	 *                                                   Default &#039;&#039;.
	 *     @type int             $hour                   Hour of the day. Default empty. Accepts numbers 0-23.
	 *     @type int|bool        $ignore_sticky_posts    Whether to ignore sticky posts or not. Setting this to false
	 *                                                   excludes stickies from &#039;post__in&#039;. Accepts 1|true, 0|false.
	 *                                                   Default false.
	 *     @type int             $m                      Combination YearMonth. Accepts any four-digit year and month
	 *                                                   numbers 01-12. Default empty.
	 *     @type string|string[] $meta_key               Meta key or keys to filter by.
	 *     @type string|string[] $meta_value             Meta value or values to filter by.
	 *     @type string          $meta_compare           MySQL operator used for comparing the meta value.
	 *                                                   See WP_Meta_Query::__construct() for accepted values and default value.
	 *     @type string          $meta_compare_key       MySQL operator used for comparing the meta key.
	 *                                                   See WP_Meta_Query::__construct() for accepted values and default value.
	 *     @type string          $meta_type              MySQL data type that the meta_value column will be CAST to for comparisons.
	 *                                                   See WP_Meta_Query::__construct() for accepted values and default value.
	 *     @type string          $meta_type_key          MySQL data type that the meta_key column will be CAST to for comparisons.
	 *                                                   See WP_Meta_Query::__construct() for accepted values and default value.
	 *     @type array           $meta_query             An associative array of WP_Meta_Query arguments.
	 *                                                   See WP_Meta_Query::__construct() for accepted values.
	 *     @type int             $menu_order             The menu order of the posts.
	 *     @type int             $minute                 Minute of the hour. Default empty. Accepts numbers 0-59.
	 *     @type int             $monthnum               The two-digit month. Default empty. Accepts numbers 1-12.
	 *     @type string          $name                   Post slug.
	 *     @type bool            $nopaging               Show all posts (true) or paginate (false). Default false.
	 *     @type bool            $no_found_rows          Whether to skip counting the total rows found. Enabling can improve
	 *                                                   performance. Default false.
	 *     @type int             $offset                 The number of posts to offset before retrieval.
	 *     @type string          $order                  Designates ascending or descending order of posts. Default &#039;DESC&#039;.
	 *                                                   Accepts &#039;ASC&#039;, &#039;DESC&#039;.
	 *     @type string|array    $orderby                Sort retrieved posts by parameter. One or more options may be passed.
	 *                                                   To use &#039;meta_value&#039;, or &#039;meta_value_num&#039;, &#039;meta_key=keyname&#039; must be
	 *                                                   also be defined. To sort by a specific `$meta_query` clause, use that
	 *                                                   clause&#039;s array key. Accepts:
	 *                                                   - &#039;none&#039;
	 *                                                   - &#039;name&#039;
	 *                                                   - &#039;author&#039;
	 *                                                   - &#039;date&#039;
	 *                                                   - &#039;title&#039;
	 *                                                   - &#039;modified&#039;
	 *                                                   - &#039;menu_order&#039;
	 *                                                   - &#039;parent&#039;
	 *                                                   - &#039;ID&#039;
	 *                                                   - &#039;rand&#039;
	 *                                                   - &#039;relevance&#039;
	 *                                                   - &#039;RAND(x)&#039; (where &#039;x&#039; is an integer seed value)
	 *                                                   - &#039;comment_count&#039;
	 *                                                   - &#039;meta_value&#039;
	 *                                                   - &#039;meta_value_num&#039;
	 *                                                   - &#039;post__in&#039;
	 *                                                   - &#039;post_name__in&#039;
	 *                                                   - &#039;post_parent__in&#039;
	 *                                                   - The array keys of `$meta_query`.
	 *                                                   Default is &#039;date&#039;, except when a search is being performed, when
	 *                                                   the default is &#039;relevance&#039;.
	 *     @type int             $p                      Post ID.
	 *     @type int             $page                   Show the number of posts that would show up on page X of a
	 *                                                   static front page.
	 *     @type int             $paged                  The number of the current page.
	 *     @type int             $page_id                Page ID.
	 *     @type string          $pagename               Page slug.
	 *     @type string          $perm                   Show posts if user has the appropriate capability.
	 *     @type string          $ping_status            Ping status.
	 *     @type int[]           $post__in               An array of post IDs to retrieve, sticky posts will be included.
	 *     @type int[]           $post__not_in           An array of post IDs not to retrieve. Note: a string of comma-
	 *                                                   separated IDs will NOT work.
	 *     @type string          $post_mime_type         The mime type of the post. Used for &#039;attachment&#039; post_type.
	 *     @type string[]        $post_name__in          An array of post slugs that results must match.
	 *     @type int             $post_parent            Page ID to retrieve child pages for. Use 0 to only retrieve
	 *                                                   top-level pages.
	 *     @type int[]           $post_parent__in        An array containing parent page IDs to query child pages from.
	 *     @type int[]           $post_parent__not_in    An array containing parent page IDs not to query child pages from.
	 *     @type string|string[] $post_type              A post type slug (string) or array of post type slugs.
	 *                                                   Default &#039;any&#039; if using &#039;tax_query&#039;.
	 *     @type string|string[] $post_status            A post status (string) or array of post statuses.
	 *     @type int             $posts_per_page         The number of posts to query for. Use -1 to request all posts.
	 *     @type int             $posts_per_archive_page The number of posts to query for by archive page. Overrides
	 *                                                   &#039;posts_per_page&#039; when is_archive(), or is_search() are true.
	 *     @type string          $s                      Search keyword(s). Prepending a term with a hyphen will
	 *                                                   exclude posts matching that term. Eg, &#039;pillow -sofa&#039; will
	 *                                                   return posts containing &#039;pillow&#039; but not &#039;sofa&#039;. The
	 *                                                   character used for exclusion can be modified using the
	 *                                                   the &#039;wp_query_search_exclusion_prefix&#039; filter.
	 *     @type string[]        $search_columns         Array of column names to be searched. Accepts &#039;post_title&#039;,
	 *                                                   &#039;post_excerpt&#039; and &#039;post_content&#039;. Default empty array.
	 *     @type int             $second                 Second of the minute. Default empty. Accepts numbers 0-59.
	 *     @type bool            $sentence               Whether to search by phrase. Default false.
	 *     @type bool            $suppress_filters       Whether to suppress filters. Default false.
	 *     @type string          $tag                    Tag slug. Comma-separated (either), Plus-separated (all).
	 *     @type int[]           $tag__and               An array of tag IDs (AND in).
	 *     @type int[]           $tag__in                An array of tag IDs (OR in).
	 *     @type int[]           $tag__not_in            An array of tag IDs (NOT in).
	 *     @type int             $tag_id                 Tag id or comma-separated list of IDs.
	 *     @type string[]        $tag_slug__and          An array of tag slugs (AND in).
	 *     @type string[]        $tag_slug__in           An array of tag slugs (OR in). unless &#039;ignore_sticky_posts&#039; is
	 *                                                   true. Note: a string of comma-separated IDs will NOT work.
	 *     @type array           $tax_query              An associative array of WP_Tax_Query arguments.
	 *                                                   See WP_Tax_Query::__construct().
	 *     @type string          $title                  Post title.
	 *     @type bool            $update_post_meta_cache Whether to update the post meta cache. Default true.
	 *     @type bool            $update_post_term_cache Whether to update the post term cache. Default true.
	 *     @type bool            $update_menu_item_cache Whether to update the menu item cache. Default false.
	 *     @type bool            $lazy_load_term_meta    Whether to lazy-load term meta. Setting to false will
	 *                                                   disable cache priming for term meta, so that each
	 *                                                   get_term_meta() call will hit the database.
	 *                                                   Defaults to the value of `$update_post_term_cache`.
	 *     @type int             $w                      The week number of the year. Default empty. Accepts numbers 1-53.
	 *     @type int             $year                   The four-digit year. Default empty. Accepts any four-digit year.
	 * }
	 */
	public function parse_query( $query = &#039;&#039; ) {
		if ( ! empty( $query ) ) {
			$this-&gt;init();
			$this-&gt;query      = wp_parse_args( $query );
			$this-&gt;query_vars = $this-&gt;query;
		} elseif ( ! isset( $this-&gt;query ) ) {
			$this-&gt;query = $this-&gt;query_vars;
		}

		$this-&gt;query_vars         = $this-&gt;fill_query_vars( $this-&gt;query_vars );
		$query_vars               = &amp;$this-&gt;query_vars;
		$this-&gt;query_vars_changed = true;

		if ( ! empty( $query_vars[&#039;robots&#039;] ) ) {
			$this-&gt;is_robots = true;
		} elseif ( ! empty( $query_vars[&#039;favicon&#039;] ) ) {
			$this-&gt;is_favicon = true;
		} elseif ( ! empty( $query_vars[&#039;sitemap&#039;] ) ) {
			$this-&gt;is_sitemap = true;
		}

		if ( ! is_scalar( $query_vars[&#039;p&#039;] ) || (int) $query_vars[&#039;p&#039;] &lt; 0 ) {
			$query_vars[&#039;p&#039;]     = 0;
			$query_vars[&#039;error&#039;] = &#039;404&#039;;
		} else {
			$query_vars[&#039;p&#039;] = (int) $query_vars[&#039;p&#039;];
		}

		$query_vars[&#039;page_id&#039;]  = is_scalar( $query_vars[&#039;page_id&#039;] ) ? absint( $query_vars[&#039;page_id&#039;] ) : 0;
		$query_vars[&#039;year&#039;]     = is_scalar( $query_vars[&#039;year&#039;] ) ? absint( $query_vars[&#039;year&#039;] ) : 0;
		$query_vars[&#039;monthnum&#039;] = is_scalar( $query_vars[&#039;monthnum&#039;] ) ? absint( $query_vars[&#039;monthnum&#039;] ) : 0;
		$query_vars[&#039;day&#039;]      = is_scalar( $query_vars[&#039;day&#039;] ) ? absint( $query_vars[&#039;day&#039;] ) : 0;
		$query_vars[&#039;w&#039;]        = is_scalar( $query_vars[&#039;w&#039;] ) ? absint( $query_vars[&#039;w&#039;] ) : 0;
		$query_vars[&#039;m&#039;]        = is_scalar( $query_vars[&#039;m&#039;] ) ? preg_replace( &#039;|[^0-9]|&#039;, &#039;&#039;, $query_vars[&#039;m&#039;] ) : &#039;&#039;;
		$query_vars[&#039;paged&#039;]    = is_scalar( $query_vars[&#039;paged&#039;] ) ? absint( $query_vars[&#039;paged&#039;] ) : 0;
		$query_vars[&#039;cat&#039;]      = preg_replace( &#039;|[^0-9,-]|&#039;, &#039;&#039;, $query_vars[&#039;cat&#039;] ); // Array or comma-separated list of positive or negative integers.
		$query_vars[&#039;author&#039;]   = is_scalar( $query_vars[&#039;author&#039;] ) ? preg_replace( &#039;|[^0-9,-]|&#039;, &#039;&#039;, $query_vars[&#039;author&#039;] ) : &#039;&#039;; // Comma-separated list of positive or negative integers.
		$query_vars[&#039;pagename&#039;] = is_scalar( $query_vars[&#039;pagename&#039;] ) ? trim( $query_vars[&#039;pagename&#039;] ) : &#039;&#039;;
		$query_vars[&#039;name&#039;]     = is_scalar( $query_vars[&#039;name&#039;] ) ? trim( $query_vars[&#039;name&#039;] ) : &#039;&#039;;
		$query_vars[&#039;title&#039;]    = is_scalar( $query_vars[&#039;title&#039;] ) ? trim( $query_vars[&#039;title&#039;] ) : &#039;&#039;;

		if ( is_scalar( $query_vars[&#039;hour&#039;] ) &amp;&amp; &#039;&#039; !== $query_vars[&#039;hour&#039;] ) {
			$query_vars[&#039;hour&#039;] = absint( $query_vars[&#039;hour&#039;] );
		} else {
			$query_vars[&#039;hour&#039;] = &#039;&#039;;
		}

		if ( is_scalar( $query_vars[&#039;minute&#039;] ) &amp;&amp; &#039;&#039; !== $query_vars[&#039;minute&#039;] ) {
			$query_vars[&#039;minute&#039;] = absint( $query_vars[&#039;minute&#039;] );
		} else {
			$query_vars[&#039;minute&#039;] = &#039;&#039;;
		}

		if ( is_scalar( $query_vars[&#039;second&#039;] ) &amp;&amp; &#039;&#039; !== $query_vars[&#039;second&#039;] ) {
			$query_vars[&#039;second&#039;] = absint( $query_vars[&#039;second&#039;] );
		} else {
			$query_vars[&#039;second&#039;] = &#039;&#039;;
		}

		if ( is_scalar( $query_vars[&#039;menu_order&#039;] ) &amp;&amp; &#039;&#039; !== $query_vars[&#039;menu_order&#039;] ) {
			$query_vars[&#039;menu_order&#039;] = absint( $query_vars[&#039;menu_order&#039;] );
		} else {
			$query_vars[&#039;menu_order&#039;] = &#039;&#039;;
		}

		// Fairly large, potentially too large, upper bound for search string lengths.
		if ( ! is_scalar( $query_vars[&#039;s&#039;] ) || ( ! empty( $query_vars[&#039;s&#039;] ) &amp;&amp; strlen( $query_vars[&#039;s&#039;] ) &gt; 1600 ) ) {
			$query_vars[&#039;s&#039;] = &#039;&#039;;
		}

		// Compat. Map subpost to attachment.
		if ( is_scalar( $query_vars[&#039;subpost&#039;] ) &amp;&amp; &#039;&#039; != $query_vars[&#039;subpost&#039;] ) {
			$query_vars[&#039;attachment&#039;] = $query_vars[&#039;subpost&#039;];
		}
		if ( is_scalar( $query_vars[&#039;subpost_id&#039;] ) &amp;&amp; &#039;&#039; != $query_vars[&#039;subpost_id&#039;] ) {
			$query_vars[&#039;attachment_id&#039;] = $query_vars[&#039;subpost_id&#039;];
		}

		$query_vars[&#039;attachment_id&#039;] = is_scalar( $query_vars[&#039;attachment_id&#039;] ) ? absint( $query_vars[&#039;attachment_id&#039;] ) : 0;

		if ( ( &#039;&#039; !== $query_vars[&#039;attachment&#039;] ) || ! empty( $query_vars[&#039;attachment_id&#039;] ) ) {
			$this-&gt;is_single     = true;
			$this-&gt;is_attachment = true;
		} elseif ( &#039;&#039; !== $query_vars[&#039;name&#039;] ) {
			$this-&gt;is_single = true;
		} elseif ( $query_vars[&#039;p&#039;] ) {
			$this-&gt;is_single = true;
		} elseif ( &#039;&#039; !== $query_vars[&#039;pagename&#039;] || ! empty( $query_vars[&#039;page_id&#039;] ) ) {
			$this-&gt;is_page   = true;
			$this-&gt;is_single = false;
		} else {
			// Look for archive queries. Dates, categories, authors, search, post type archives.

			if ( isset( $this-&gt;query[&#039;s&#039;] ) ) {
				$this-&gt;is_search = true;
			}

			if ( &#039;&#039; !== $query_vars[&#039;second&#039;] ) {
				$this-&gt;is_time = true;
				$this-&gt;is_date = true;
			}

			if ( &#039;&#039; !== $query_vars[&#039;minute&#039;] ) {
				$this-&gt;is_time = true;
				$this-&gt;is_date = true;
			}

			if ( &#039;&#039; !== $query_vars[&#039;hour&#039;] ) {
				$this-&gt;is_time = true;
				$this-&gt;is_date = true;
			}

			if ( $query_vars[&#039;day&#039;] ) {
				if ( ! $this-&gt;is_date ) {
					$date = sprintf( &#039;%04d-%02d-%02d&#039;, $query_vars[&#039;year&#039;], $query_vars[&#039;monthnum&#039;], $query_vars[&#039;day&#039;] );
					if ( $query_vars[&#039;monthnum&#039;] &amp;&amp; $query_vars[&#039;year&#039;] &amp;&amp; ! wp_checkdate( $query_vars[&#039;monthnum&#039;], $query_vars[&#039;day&#039;], $query_vars[&#039;year&#039;], $date ) ) {
						$query_vars[&#039;error&#039;] = &#039;404&#039;;
					} else {
						$this-&gt;is_day  = true;
						$this-&gt;is_date = true;
					}
				}
			}

			if ( $query_vars[&#039;monthnum&#039;] ) {
				if ( ! $this-&gt;is_date ) {
					if ( 12 &lt; $query_vars[&#039;monthnum&#039;] ) {
						$query_vars[&#039;error&#039;] = &#039;404&#039;;
					} else {
						$this-&gt;is_month = true;
						$this-&gt;is_date  = true;
					}
				}
			}

			if ( $query_vars[&#039;year&#039;] ) {
				if ( ! $this-&gt;is_date ) {
					$this-&gt;is_year = true;
					$this-&gt;is_date = true;
				}
			}

			if ( $query_vars[&#039;m&#039;] ) {
				$this-&gt;is_date = true;
				if ( strlen( $query_vars[&#039;m&#039;] ) &gt; 9 ) {
					$this-&gt;is_time = true;
				} elseif ( strlen( $query_vars[&#039;m&#039;] ) &gt; 7 ) {
					$this-&gt;is_day = true;
				} elseif ( strlen( $query_vars[&#039;m&#039;] ) &gt; 5 ) {
					$this-&gt;is_month = true;
				} else {
					$this-&gt;is_year = true;
				}
			}

			if ( $query_vars[&#039;w&#039;] ) {
				$this-&gt;is_date = true;
			}

			$this-&gt;query_vars_hash = false;
			$this-&gt;parse_tax_query( $query_vars );

			foreach ( $this-&gt;tax_query-&gt;queries as $tax_query ) {
				if ( ! is_array( $tax_query ) ) {
					continue;
				}

				if ( isset( $tax_query[&#039;operator&#039;] ) &amp;&amp; &#039;NOT IN&#039; !== $tax_query[&#039;operator&#039;] ) {
					switch ( $tax_query[&#039;taxonomy&#039;] ) {
						case &#039;category&#039;:
							$this-&gt;is_category = true;
							break;
						case &#039;post_tag&#039;:
							$this-&gt;is_tag = true;
							break;
						default:
							$this-&gt;is_tax = true;
					}
				}
			}
			unset( $tax_query );

			if ( empty( $query_vars[&#039;author&#039;] ) || ( &#039;0&#039; == $query_vars[&#039;author&#039;] ) ) {
				$this-&gt;is_author = false;
			} else {
				$this-&gt;is_author = true;
			}

			if ( &#039;&#039; !== $query_vars[&#039;author_name&#039;] ) {
				$this-&gt;is_author = true;
			}

			if ( ! empty( $query_vars[&#039;post_type&#039;] ) &amp;&amp; ! is_array( $query_vars[&#039;post_type&#039;] ) ) {
				$post_type_obj = get_post_type_object( $query_vars[&#039;post_type&#039;] );
				if ( ! empty( $post_type_obj-&gt;has_archive ) ) {
					$this-&gt;is_post_type_archive = true;
				}
			}

			if ( $this-&gt;is_post_type_archive || $this-&gt;is_date || $this-&gt;is_author || $this-&gt;is_category || $this-&gt;is_tag || $this-&gt;is_tax ) {
				$this-&gt;is_archive = true;
			}
		}

		if ( &#039;&#039; != $query_vars[&#039;feed&#039;] ) {
			$this-&gt;is_feed = true;
		}

		if ( &#039;&#039; != $query_vars[&#039;embed&#039;] ) {
			$this-&gt;is_embed = true;
		}

		if ( &#039;&#039; != $query_vars[&#039;tb&#039;] ) {
			$this-&gt;is_trackback = true;
		}

		if ( &#039;&#039; != $query_vars[&#039;paged&#039;] &amp;&amp; ( (int) $query_vars[&#039;paged&#039;] &gt; 1 ) ) {
			$this-&gt;is_paged = true;
		}

		// If we&#039;re previewing inside the write screen.
		if ( &#039;&#039; != $query_vars[&#039;preview&#039;] ) {
			$this-&gt;is_preview = true;
		}

		if ( is_admin() ) {
			$this-&gt;is_admin = true;
		}

		if ( str_contains( $query_vars[&#039;feed&#039;], &#039;comments-&#039; ) ) {
			$query_vars[&#039;feed&#039;]         = str_replace( &#039;comments-&#039;, &#039;&#039;, $query_vars[&#039;feed&#039;] );
			$query_vars[&#039;withcomments&#039;] = 1;
		}

		$this-&gt;is_singular = $this-&gt;is_single || $this-&gt;is_page || $this-&gt;is_attachment;

		if ( $this-&gt;is_feed &amp;&amp; ( ! empty( $query_vars[&#039;withcomments&#039;] ) || ( empty( $query_vars[&#039;withoutcomments&#039;] ) &amp;&amp; $this-&gt;is_singular ) ) ) {
			$this-&gt;is_comment_feed = true;
		}

		if ( ! ( $this-&gt;is_singular || $this-&gt;is_archive || $this-&gt;is_search || $this-&gt;is_feed
				|| ( wp_is_serving_rest_request() &amp;&amp; $this-&gt;is_main_query() )
				|| $this-&gt;is_trackback || $this-&gt;is_404 || $this-&gt;is_admin || $this-&gt;is_robots || $this-&gt;is_favicon || $this-&gt;is_sitemap ) ) {
			$this-&gt;is_home = true;
		}

		// Correct `is_*` for &#039;page_on_front&#039; and &#039;page_for_posts&#039;.
		if ( $this-&gt;is_home &amp;&amp; &#039;page&#039; === get_option( &#039;show_on_front&#039; ) &amp;&amp; get_option( &#039;page_on_front&#039; ) ) {
			$_query = wp_parse_args( $this-&gt;query );
			// &#039;pagename&#039; can be set and empty depending on matched rewrite rules. Ignore an empty &#039;pagename&#039;.
			if ( isset( $_query[&#039;pagename&#039;] ) &amp;&amp; &#039;&#039; === $_query[&#039;pagename&#039;] ) {
				unset( $_query[&#039;pagename&#039;] );
			}

			unset( $_query[&#039;embed&#039;] );

			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( &#039;preview&#039;, &#039;page&#039;, &#039;paged&#039;, &#039;cpage&#039; ) ) ) {
				$this-&gt;is_page         = true;
				$this-&gt;is_home         = false;
				$query_vars[&#039;page_id&#039;] = get_option( &#039;page_on_front&#039; );
				// Correct &lt;!--nextpage--&gt; for &#039;page_on_front&#039;.
				if ( ! empty( $query_vars[&#039;paged&#039;] ) ) {
					$query_vars[&#039;page&#039;] = $query_vars[&#039;paged&#039;];
					unset( $query_vars[&#039;paged&#039;] );
				}
			}
		}

		if ( &#039;&#039; !== $query_vars[&#039;pagename&#039;] ) {
			$this-&gt;queried_object = get_page_by_path( $query_vars[&#039;pagename&#039;] );

			if ( $this-&gt;queried_object &amp;&amp; &#039;attachment&#039; === $this-&gt;queried_object-&gt;post_type ) {
				if ( preg_match( &#039;/^[^%]*%(?:postname)%/&#039;, get_option( &#039;permalink_structure&#039; ) ) ) {
					// See if we also have a post with the same slug.
					$post = get_page_by_path( $query_vars[&#039;pagename&#039;], OBJECT, &#039;post&#039; );
					if ( $post ) {
						$this-&gt;queried_object = $post;
						$this-&gt;is_page        = false;
						$this-&gt;is_single      = true;
					}
				}
			}

			if ( ! empty( $this-&gt;queried_object ) ) {
				$this-&gt;queried_object_id = (int) $this-&gt;queried_object-&gt;ID;
			} else {
				unset( $this-&gt;queried_object );
			}

			if ( &#039;page&#039; === get_option( &#039;show_on_front&#039; ) &amp;&amp; isset( $this-&gt;queried_object_id ) &amp;&amp; get_option( &#039;page_for_posts&#039; ) == $this-&gt;queried_object_id ) {
				$this-&gt;is_page       = false;
				$this-&gt;is_home       = true;
				$this-&gt;is_posts_page = true;
			}

			if ( isset( $this-&gt;queried_object_id ) &amp;&amp; get_option( &#039;wp_page_for_privacy_policy&#039; ) == $this-&gt;queried_object_id ) {
				$this-&gt;is_privacy_policy = true;
			}
		}

		if ( $query_vars[&#039;page_id&#039;] ) {
			if ( &#039;page&#039; === get_option( &#039;show_on_front&#039; ) &amp;&amp; get_option( &#039;page_for_posts&#039; ) == $query_vars[&#039;page_id&#039;] ) {
				$this-&gt;is_page       = false;
				$this-&gt;is_home       = true;
				$this-&gt;is_posts_page = true;
			}

			if ( get_option( &#039;wp_page_for_privacy_policy&#039; ) == $query_vars[&#039;page_id&#039;] ) {
				$this-&gt;is_privacy_policy = true;
			}
		}

		if ( ! empty( $query_vars[&#039;post_type&#039;] ) ) {
			if ( is_array( $query_vars[&#039;post_type&#039;] ) ) {
				$query_vars[&#039;post_type&#039;] = array_map( &#039;sanitize_key&#039;, array_unique( $query_vars[&#039;post_type&#039;] ) );
				sort( $query_vars[&#039;post_type&#039;] );
			} else {
				$query_vars[&#039;post_type&#039;] = sanitize_key( $query_vars[&#039;post_type&#039;] );
			}
		}

		if ( ! empty( $query_vars[&#039;post_status&#039;] ) ) {
			if ( is_array( $query_vars[&#039;post_status&#039;] ) ) {
				$query_vars[&#039;post_status&#039;] = array_map( &#039;sanitize_key&#039;, array_unique( $query_vars[&#039;post_status&#039;] ) );
				sort( $query_vars[&#039;post_status&#039;] );
			} else {
				$query_vars[&#039;post_status&#039;] = preg_replace( &#039;|[^a-z0-9_,-]|&#039;, &#039;&#039;, $query_vars[&#039;post_status&#039;] );
			}
		}

		if ( $this-&gt;is_posts_page &amp;&amp; ( ! isset( $query_vars[&#039;withcomments&#039;] ) || ! $query_vars[&#039;withcomments&#039;] ) ) {
			$this-&gt;is_comment_feed = false;
		}

		$this-&gt;is_singular = $this-&gt;is_single || $this-&gt;is_page || $this-&gt;is_attachment;
		// Done correcting `is_*` for &#039;page_on_front&#039; and &#039;page_for_posts&#039;.

		if ( &#039;404&#039; == $query_vars[&#039;error&#039;] ) {
			$this-&gt;set_404();
		}

		$this-&gt;is_embed = $this-&gt;is_embed &amp;&amp; ( $this-&gt;is_singular || $this-&gt;is_404 );

		$this-&gt;query_vars_hash    = md5( serialize( $this-&gt;query_vars ) );
		$this-&gt;query_vars_changed = false;

		/**
		 * Fires after the main query vars have been parsed.
		 *
		 * @since 1.5.0
		 *
		 * @param WP_Query $query The WP_Query instance (passed by reference).
		 */
		do_action_ref_array( &#039;parse_query&#039;, array( &amp;$this ) );
	}

	/**
	 * Parses various taxonomy related query vars.
	 *
	 * For BC, this method is not marked as protected. See [28987].
	 *
	 * @since 3.1.0
	 *
	 * @param array $query_vars The query variables. Passed by reference.
	 */
	public function parse_tax_query( &amp;$query_vars ) {
		if ( ! empty( $query_vars[&#039;tax_query&#039;] ) &amp;&amp; is_array( $query_vars[&#039;tax_query&#039;] ) ) {
			$tax_query = $query_vars[&#039;tax_query&#039;];
		} else {
			$tax_query = array();
		}

		if ( ! empty( $query_vars[&#039;taxonomy&#039;] ) &amp;&amp; ! empty( $query_vars[&#039;term&#039;] ) ) {
			$tax_query[] = array(
				&#039;taxonomy&#039; =&gt; $query_vars[&#039;taxonomy&#039;],
				&#039;terms&#039;    =&gt; array( $query_vars[&#039;term&#039;] ),
				&#039;field&#039;    =&gt; &#039;slug&#039;,
			);
		}

		foreach ( get_taxonomies( array(), &#039;objects&#039; ) as $taxonomy =&gt; $t ) {
			if ( &#039;post_tag&#039; === $taxonomy ) {
				continue; // Handled further down in the $query_vars[&#039;tag&#039;] block.
			}

			if ( $t-&gt;query_var &amp;&amp; ! empty( $query_vars[ $t-&gt;query_var ] ) ) {
				$tax_query_defaults = array(
					&#039;taxonomy&#039; =&gt; $taxonomy,
					&#039;field&#039;    =&gt; &#039;slug&#039;,
				);

				if ( is_string( $query_vars[ $t-&gt;query_var ] ) &amp;&amp; ! empty( $t-&gt;rewrite[&#039;hierarchical&#039;] ) ) {
					$query_vars[ $t-&gt;query_var ] = wp_basename( $query_vars[ $t-&gt;query_var ] );
				}

				$term = $query_vars[ $t-&gt;query_var ];

				if ( ! is_array( $term ) ) {
					$term = explode( &#039;,&#039;, $term );
					$term = array_map( &#039;trim&#039;, $term );
				}
				sort( $term );
				$term = implode( &#039;,&#039;, $term );

				if ( str_contains( $term, &#039;+&#039; ) ) {
					$terms = preg_split( &#039;/[+]+/&#039;, $term );
					foreach ( $terms as $term ) {
						$tax_query[] = array_merge(
							$tax_query_defaults,
							array(
								&#039;terms&#039; =&gt; array( $term ),
							)
						);
					}
				} else {
					$tax_query[] = array_merge(
						$tax_query_defaults,
						array(
							&#039;terms&#039; =&gt; preg_split( &#039;/[,]+/&#039;, $term ),
						)
					);
				}
			}
		}

		// If query string &#039;cat&#039; is an array, implode it.
		if ( is_array( $query_vars[&#039;cat&#039;] ) ) {
			$query_vars[&#039;cat&#039;] = implode( &#039;,&#039;, $query_vars[&#039;cat&#039;] );
		}

		// Category stuff.

		if ( ! empty( $query_vars[&#039;cat&#039;] ) &amp;&amp; ! $this-&gt;is_singular ) {
			$cat_in     = array();
			$cat_not_in = array();

			$cat_array = preg_split( &#039;/[,\s]+/&#039;, urldecode( $query_vars[&#039;cat&#039;] ) );
			$cat_array = array_map( &#039;intval&#039;, $cat_array );
			sort( $cat_array );
			$query_vars[&#039;cat&#039;] = implode( &#039;,&#039;, $cat_array );

			foreach ( $cat_array as $cat ) {
				if ( $cat &gt; 0 ) {
					$cat_in[] = $cat;
				} elseif ( $cat &lt; 0 ) {
					$cat_not_in[] = abs( $cat );
				}
			}

			if ( ! empty( $cat_in ) ) {
				$tax_query[] = array(
					&#039;taxonomy&#039;         =&gt; &#039;category&#039;,
					&#039;terms&#039;            =&gt; $cat_in,
					&#039;field&#039;            =&gt; &#039;term_id&#039;,
					&#039;include_children&#039; =&gt; true,
				);
			}

			if ( ! empty( $cat_not_in ) ) {
				$tax_query[] = array(
					&#039;taxonomy&#039;         =&gt; &#039;category&#039;,
					&#039;terms&#039;            =&gt; $cat_not_in,
					&#039;field&#039;            =&gt; &#039;term_id&#039;,
					&#039;operator&#039;         =&gt; &#039;NOT IN&#039;,
					&#039;include_children&#039; =&gt; true,
				);
			}
			unset( $cat_array, $cat_in, $cat_not_in );
		}

		if ( ! empty( $query_vars[&#039;category__and&#039;] ) &amp;&amp; 1 === count( (array) $query_vars[&#039;category__and&#039;] ) ) {
			$query_vars[&#039;category__and&#039;] = (array) $query_vars[&#039;category__and&#039;];
			if ( ! isset( $query_vars[&#039;category__in&#039;] ) ) {
				$query_vars[&#039;category__in&#039;] = array();
			}
			$query_vars[&#039;category__in&#039;][] = absint( reset( $query_vars[&#039;category__and&#039;] ) );
			unset( $query_vars[&#039;category__and&#039;] );
		}

		if ( ! empty( $query_vars[&#039;category__in&#039;] ) ) {
			$query_vars[&#039;category__in&#039;] = array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;category__in&#039;] ) );
			sort( $query_vars[&#039;category__in&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039;         =&gt; &#039;category&#039;,
				&#039;terms&#039;            =&gt; $query_vars[&#039;category__in&#039;],
				&#039;field&#039;            =&gt; &#039;term_id&#039;,
				&#039;include_children&#039; =&gt; false,
			);
		}

		if ( ! empty( $query_vars[&#039;category__not_in&#039;] ) ) {
			$query_vars[&#039;category__not_in&#039;] = array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;category__not_in&#039;] ) );
			sort( $query_vars[&#039;category__not_in&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039;         =&gt; &#039;category&#039;,
				&#039;terms&#039;            =&gt; $query_vars[&#039;category__not_in&#039;],
				&#039;operator&#039;         =&gt; &#039;NOT IN&#039;,
				&#039;include_children&#039; =&gt; false,
			);
		}

		if ( ! empty( $query_vars[&#039;category__and&#039;] ) ) {
			$query_vars[&#039;category__and&#039;] = array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;category__and&#039;] ) );
			sort( $query_vars[&#039;category__and&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039;         =&gt; &#039;category&#039;,
				&#039;terms&#039;            =&gt; $query_vars[&#039;category__and&#039;],
				&#039;field&#039;            =&gt; &#039;term_id&#039;,
				&#039;operator&#039;         =&gt; &#039;AND&#039;,
				&#039;include_children&#039; =&gt; false,
			);
		}

		// If query string &#039;tag&#039; is array, implode it.
		if ( is_array( $query_vars[&#039;tag&#039;] ) ) {
			$query_vars[&#039;tag&#039;] = implode( &#039;,&#039;, $query_vars[&#039;tag&#039;] );
		}

		// Tag stuff.

		if ( &#039;&#039; !== $query_vars[&#039;tag&#039;] &amp;&amp; ! $this-&gt;is_singular &amp;&amp; $this-&gt;query_vars_changed ) {
			if ( str_contains( $query_vars[&#039;tag&#039;], &#039;,&#039; ) ) {
				// @todo Handle normalizing `tag` query string.
				$tags = preg_split( &#039;/[,\r\n\t ]+/&#039;, $query_vars[&#039;tag&#039;] );
				foreach ( (array) $tags as $tag ) {
					$tag                          = sanitize_term_field( &#039;slug&#039;, $tag, 0, &#039;post_tag&#039;, &#039;db&#039; );
					$query_vars[&#039;tag_slug__in&#039;][] = $tag;
					sort( $query_vars[&#039;tag_slug__in&#039;] );
				}
			} elseif ( preg_match( &#039;/[+\r\n\t ]+/&#039;, $query_vars[&#039;tag&#039;] ) || ! empty( $query_vars[&#039;cat&#039;] ) ) {
				$tags = preg_split( &#039;/[+\r\n\t ]+/&#039;, $query_vars[&#039;tag&#039;] );
				foreach ( (array) $tags as $tag ) {
					$tag                           = sanitize_term_field( &#039;slug&#039;, $tag, 0, &#039;post_tag&#039;, &#039;db&#039; );
					$query_vars[&#039;tag_slug__and&#039;][] = $tag;
				}
			} else {
				$query_vars[&#039;tag&#039;]            = sanitize_term_field( &#039;slug&#039;, $query_vars[&#039;tag&#039;], 0, &#039;post_tag&#039;, &#039;db&#039; );
				$query_vars[&#039;tag_slug__in&#039;][] = $query_vars[&#039;tag&#039;];
				sort( $query_vars[&#039;tag_slug__in&#039;] );
			}
		}

		if ( ! empty( $query_vars[&#039;tag_id&#039;] ) ) {
			$query_vars[&#039;tag_id&#039;] = absint( $query_vars[&#039;tag_id&#039;] );
			$tax_query[]          = array(
				&#039;taxonomy&#039; =&gt; &#039;post_tag&#039;,
				&#039;terms&#039;    =&gt; $query_vars[&#039;tag_id&#039;],
			);
		}

		if ( ! empty( $query_vars[&#039;tag__in&#039;] ) ) {
			$query_vars[&#039;tag__in&#039;] = array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;tag__in&#039;] ) );
			sort( $query_vars[&#039;tag__in&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039; =&gt; &#039;post_tag&#039;,
				&#039;terms&#039;    =&gt; $query_vars[&#039;tag__in&#039;],
			);
		}

		if ( ! empty( $query_vars[&#039;tag__not_in&#039;] ) ) {
			$query_vars[&#039;tag__not_in&#039;] = array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;tag__not_in&#039;] ) );
			sort( $query_vars[&#039;tag__not_in&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039; =&gt; &#039;post_tag&#039;,
				&#039;terms&#039;    =&gt; $query_vars[&#039;tag__not_in&#039;],
				&#039;operator&#039; =&gt; &#039;NOT IN&#039;,
			);
		}

		if ( ! empty( $query_vars[&#039;tag__and&#039;] ) ) {
			$query_vars[&#039;tag__and&#039;] = array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;tag__and&#039;] ) );
			sort( $query_vars[&#039;tag__and&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039; =&gt; &#039;post_tag&#039;,
				&#039;terms&#039;    =&gt; $query_vars[&#039;tag__and&#039;],
				&#039;operator&#039; =&gt; &#039;AND&#039;,
			);
		}

		if ( ! empty( $query_vars[&#039;tag_slug__in&#039;] ) ) {
			$query_vars[&#039;tag_slug__in&#039;] = array_map( &#039;sanitize_title_for_query&#039;, array_unique( (array) $query_vars[&#039;tag_slug__in&#039;] ) );
			sort( $query_vars[&#039;tag_slug__in&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039; =&gt; &#039;post_tag&#039;,
				&#039;terms&#039;    =&gt; $query_vars[&#039;tag_slug__in&#039;],
				&#039;field&#039;    =&gt; &#039;slug&#039;,
			);
		}

		if ( ! empty( $query_vars[&#039;tag_slug__and&#039;] ) ) {
			$query_vars[&#039;tag_slug__and&#039;] = array_map( &#039;sanitize_title_for_query&#039;, array_unique( (array) $query_vars[&#039;tag_slug__and&#039;] ) );
			sort( $query_vars[&#039;tag_slug__and&#039;] );
			$tax_query[] = array(
				&#039;taxonomy&#039; =&gt; &#039;post_tag&#039;,
				&#039;terms&#039;    =&gt; $query_vars[&#039;tag_slug__and&#039;],
				&#039;field&#039;    =&gt; &#039;slug&#039;,
				&#039;operator&#039; =&gt; &#039;AND&#039;,
			);
		}

		$this-&gt;tax_query = new WP_Tax_Query( $tax_query );

		/**
		 * Fires after taxonomy-related query vars have been parsed.
		 *
		 * @since 3.7.0
		 *
		 * @param WP_Query $query The WP_Query instance.
		 */
		do_action( &#039;parse_tax_query&#039;, $this );
	}

	/**
	 * Generates SQL for the WHERE clause based on passed search terms.
	 *
	 * @since 3.7.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param array $query_vars Query variables.
	 * @return string WHERE clause.
	 */
	protected function parse_search( &amp;$query_vars ) {
		global $wpdb;

		$search = &#039;&#039;;

		// Added slashes screw with quote grouping when done early, so done later.
		$query_vars[&#039;s&#039;] = stripslashes( $query_vars[&#039;s&#039;] );
		if ( empty( $_GET[&#039;s&#039;] ) &amp;&amp; $this-&gt;is_main_query() ) {
			$query_vars[&#039;s&#039;] = urldecode( $query_vars[&#039;s&#039;] );
		}
		// There are no line breaks in &lt;input /&gt; fields.
		$query_vars[&#039;s&#039;]                  = str_replace( array( &quot;\r&quot;, &quot;\n&quot; ), &#039;&#039;, $query_vars[&#039;s&#039;] );
		$query_vars[&#039;search_terms_count&#039;] = 1;
		if ( ! empty( $query_vars[&#039;sentence&#039;] ) ) {
			$query_vars[&#039;search_terms&#039;] = array( $query_vars[&#039;s&#039;] );
		} else {
			if ( preg_match_all( &#039;/&quot;.*?(&quot;|$)|((?&lt;=[\t &quot;,+])|^)[^\t &quot;,+]+/&#039;, $query_vars[&#039;s&#039;], $matches ) ) {
				$query_vars[&#039;search_terms_count&#039;] = count( $matches[0] );
				$query_vars[&#039;search_terms&#039;]       = $this-&gt;parse_search_terms( $matches[0] );
				// If the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence.
				if ( empty( $query_vars[&#039;search_terms&#039;] ) || count( $query_vars[&#039;search_terms&#039;] ) &gt; 9 ) {
					$query_vars[&#039;search_terms&#039;] = array( $query_vars[&#039;s&#039;] );
				}
			} else {
				$query_vars[&#039;search_terms&#039;] = array( $query_vars[&#039;s&#039;] );
			}
		}

		$n                                  = ! empty( $query_vars[&#039;exact&#039;] ) ? &#039;&#039; : &#039;%&#039;;
		$searchand                          = &#039;&#039;;
		$query_vars[&#039;search_orderby_title&#039;] = array();

		$default_search_columns = array( &#039;post_title&#039;, &#039;post_excerpt&#039;, &#039;post_content&#039; );
		$search_columns         = ! empty( $query_vars[&#039;search_columns&#039;] ) ? $query_vars[&#039;search_columns&#039;] : $default_search_columns;
		if ( ! is_array( $search_columns ) ) {
			$search_columns = array( $search_columns );
		}

		/**
		 * Filters the columns to search in a WP_Query search.
		 *
		 * The supported columns are `post_title`, `post_excerpt` and `post_content`.
		 * They are all included by default.
		 *
		 * @since 6.2.0
		 *
		 * @param string[] $search_columns Array of column names to be searched.
		 * @param string   $search         Text being searched.
		 * @param WP_Query $query          The current WP_Query instance.
		 */
		$search_columns = (array) apply_filters( &#039;post_search_columns&#039;, $search_columns, $query_vars[&#039;s&#039;], $this );

		// Use only supported search columns.
		$search_columns = array_intersect( $search_columns, $default_search_columns );
		if ( empty( $search_columns ) ) {
			$search_columns = $default_search_columns;
		}

		/**
		 * Filters the prefix that indicates that a search term should be excluded from results.
		 *
		 * @since 4.7.0
		 *
		 * @param string $exclusion_prefix The prefix. Default &#039;-&#039;. Returning
		 *                                 an empty value disables exclusions.
		 */
		$exclusion_prefix = apply_filters( &#039;wp_query_search_exclusion_prefix&#039;, &#039;-&#039; );

		foreach ( $query_vars[&#039;search_terms&#039;] as $term ) {
			// If there is an $exclusion_prefix, terms prefixed with it should be excluded.
			$exclude = $exclusion_prefix &amp;&amp; str_starts_with( $term, $exclusion_prefix );
			if ( $exclude ) {
				$like_op  = &#039;NOT LIKE&#039;;
				$andor_op = &#039;AND&#039;;
				$term     = substr( $term, 1 );
			} else {
				$like_op  = &#039;LIKE&#039;;
				$andor_op = &#039;OR&#039;;
			}

			if ( $n &amp;&amp; ! $exclude ) {
				$like                                 = &#039;%&#039; . $wpdb-&gt;esc_like( $term ) . &#039;%&#039;;
				$query_vars[&#039;search_orderby_title&#039;][] = $wpdb-&gt;prepare( &quot;{$wpdb-&gt;posts}.post_title LIKE %s&quot;, $like );
			}

			$like = $n . $wpdb-&gt;esc_like( $term ) . $n;

			$search_columns_parts = array();
			foreach ( $search_columns as $search_column ) {
				$search_columns_parts[ $search_column ] = $wpdb-&gt;prepare( &quot;({$wpdb-&gt;posts}.$search_column $like_op %s)&quot;, $like );
			}

			if ( ! empty( $this-&gt;allow_query_attachment_by_filename ) ) {
				$search_columns_parts[&#039;attachment&#039;] = $wpdb-&gt;prepare( &quot;(sq1.meta_value $like_op %s)&quot;, $like );
			}

			$search .= &quot;$searchand(&quot; . implode( &quot; $andor_op &quot;, $search_columns_parts ) . &#039;)&#039;;

			$searchand = &#039; AND &#039;;
		}

		if ( ! empty( $search ) ) {
			$search = &quot; AND ({$search}) &quot;;
			if ( ! is_user_logged_in() ) {
				$search .= &quot; AND ({$wpdb-&gt;posts}.post_password = &#039;&#039;) &quot;;
			}
		}

		return $search;
	}

	/**
	 * Checks if the terms are suitable for searching.
	 *
	 * Uses an array of stopwords (terms) that are excluded from the separate
	 * term matching when searching for posts. The list of English stopwords is
	 * the approximate search engines list, and is translatable.
	 *
	 * @since 3.7.0
	 *
	 * @param string[] $terms Array of terms to check.
	 * @return string[] Terms that are not stopwords.
	 */
	protected function parse_search_terms( $terms ) {
		$strtolower = function_exists( &#039;mb_strtolower&#039; ) ? &#039;mb_strtolower&#039; : &#039;strtolower&#039;;
		$checked    = array();

		$stopwords = $this-&gt;get_search_stopwords();

		foreach ( $terms as $term ) {
			// Keep before/after spaces when term is for exact match.
			if ( preg_match( &#039;/^&quot;.+&quot;$/&#039;, $term ) ) {
				$term = trim( $term, &quot;\&quot;&#039;&quot; );
			} else {
				$term = trim( $term, &quot;\&quot;&#039; &quot; );
			}

			// Avoid single A-Z and single dashes.
			if ( ! $term || ( 1 === strlen( $term ) &amp;&amp; preg_match( &#039;/^[a-z\-]$/i&#039;, $term ) ) ) {
				continue;
			}

			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) {
				continue;
			}

			$checked[] = $term;
		}

		return $checked;
	}

	/**
	 * Retrieves stopwords used when parsing search terms.
	 *
	 * @since 3.7.0
	 *
	 * @return string[] Stopwords.
	 */
	protected function get_search_stopwords() {
		if ( isset( $this-&gt;stopwords ) ) {
			return $this-&gt;stopwords;
		}

		/*
		 * translators: This is a comma-separated list of very common words that should be excluded from a search,
		 * like a, an, and the. These are usually called &quot;stopwords&quot;. You should not simply translate these individual
		 * words into your language. Instead, look for and provide commonly accepted stopwords in your language.
		 */
		$words = explode(
			&#039;,&#039;,
			_x(
				&#039;about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www&#039;,
				&#039;Comma-separated list of search stopwords in your language&#039;
			)
		);

		$stopwords = array();
		foreach ( $words as $word ) {
			$word = trim( $word, &quot;\r\n\t &quot; );
			if ( $word ) {
				$stopwords[] = $word;
			}
		}

		/**
		 * Filters stopwords used when parsing search terms.
		 *
		 * @since 3.7.0
		 *
		 * @param string[] $stopwords Array of stopwords.
		 */
		$this-&gt;stopwords = apply_filters( &#039;wp_search_stopwords&#039;, $stopwords );
		return $this-&gt;stopwords;
	}

	/**
	 * Generates SQL for the ORDER BY condition based on passed search terms.
	 *
	 * @since 3.7.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param array $query_vars Query variables.
	 * @return string ORDER BY clause.
	 */
	protected function parse_search_order( &amp;$query_vars ) {
		global $wpdb;

		if ( $query_vars[&#039;search_terms_count&#039;] &gt; 1 ) {
			$num_terms = count( $query_vars[&#039;search_orderby_title&#039;] );

			// If the search terms contain negative queries, don&#039;t bother ordering by sentence matches.
			$like = &#039;&#039;;
			if ( ! preg_match( &#039;/(?:\s|^)\-/&#039;, $query_vars[&#039;s&#039;] ) ) {
				$like = &#039;%&#039; . $wpdb-&gt;esc_like( $query_vars[&#039;s&#039;] ) . &#039;%&#039;;
			}

			$search_orderby = &#039;&#039;;

			// Sentence match in &#039;post_title&#039;.
			if ( $like ) {
				$search_orderby .= $wpdb-&gt;prepare( &quot;WHEN {$wpdb-&gt;posts}.post_title LIKE %s THEN 1 &quot;, $like );
			}

			/*
			 * Sanity limit, sort as sentence when more than 6 terms
			 * (few searches are longer than 6 terms and most titles are not).
			 */
			if ( $num_terms &lt; 7 ) {
				// All words in title.
				$search_orderby .= &#039;WHEN &#039; . implode( &#039; AND &#039;, $query_vars[&#039;search_orderby_title&#039;] ) . &#039; THEN 2 &#039;;
				// Any word in title, not needed when $num_terms == 1.
				if ( $num_terms &gt; 1 ) {
					$search_orderby .= &#039;WHEN &#039; . implode( &#039; OR &#039;, $query_vars[&#039;search_orderby_title&#039;] ) . &#039; THEN 3 &#039;;
				}
			}

			// Sentence match in &#039;post_content&#039; and &#039;post_excerpt&#039;.
			if ( $like ) {
				$search_orderby .= $wpdb-&gt;prepare( &quot;WHEN {$wpdb-&gt;posts}.post_excerpt LIKE %s THEN 4 &quot;, $like );
				$search_orderby .= $wpdb-&gt;prepare( &quot;WHEN {$wpdb-&gt;posts}.post_content LIKE %s THEN 5 &quot;, $like );
			}

			if ( $search_orderby ) {
				$search_orderby = &#039;(CASE &#039; . $search_orderby . &#039;ELSE 6 END)&#039;;
			}
		} else {
			// Single word or sentence search.
			$search_orderby = reset( $query_vars[&#039;search_orderby_title&#039;] ) . &#039; DESC&#039;;
		}

		return $search_orderby;
	}

	/**
	 * Converts the given orderby alias (if allowed) to a properly-prefixed value.
	 *
	 * @since 4.0.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param string $orderby Alias for the field to order by.
	 * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise.
	 */
	protected function parse_orderby( $orderby ) {
		global $wpdb;

		// Used to filter values.
		$allowed_keys = array(
			&#039;post_name&#039;,
			&#039;post_author&#039;,
			&#039;post_date&#039;,
			&#039;post_title&#039;,
			&#039;post_modified&#039;,
			&#039;post_parent&#039;,
			&#039;post_type&#039;,
			&#039;name&#039;,
			&#039;author&#039;,
			&#039;date&#039;,
			&#039;title&#039;,
			&#039;modified&#039;,
			&#039;parent&#039;,
			&#039;type&#039;,
			&#039;ID&#039;,
			&#039;menu_order&#039;,
			&#039;comment_count&#039;,
			&#039;rand&#039;,
			&#039;post__in&#039;,
			&#039;post_parent__in&#039;,
			&#039;post_name__in&#039;,
		);

		$primary_meta_key   = &#039;&#039;;
		$primary_meta_query = false;
		$meta_clauses       = $this-&gt;meta_query-&gt;get_clauses();
		if ( ! empty( $meta_clauses ) ) {
			$primary_meta_query = reset( $meta_clauses );

			if ( ! empty( $primary_meta_query[&#039;key&#039;] ) ) {
				$primary_meta_key = $primary_meta_query[&#039;key&#039;];
				$allowed_keys[]   = $primary_meta_key;
			}

			$allowed_keys[] = &#039;meta_value&#039;;
			$allowed_keys[] = &#039;meta_value_num&#039;;
			$allowed_keys   = array_merge( $allowed_keys, array_keys( $meta_clauses ) );
		}

		// If RAND() contains a seed value, sanitize and add to allowed keys.
		$rand_with_seed = false;
		if ( preg_match( &#039;/RAND\(([0-9]+)\)/i&#039;, $orderby, $matches ) ) {
			$orderby        = sprintf( &#039;RAND(%s)&#039;, (int) $matches[1] );
			$allowed_keys[] = $orderby;
			$rand_with_seed = true;
		}

		if ( ! in_array( $orderby, $allowed_keys, true ) ) {
			return false;
		}

		$orderby_clause = &#039;&#039;;

		switch ( $orderby ) {
			case &#039;post_name&#039;:
			case &#039;post_author&#039;:
			case &#039;post_date&#039;:
			case &#039;post_title&#039;:
			case &#039;post_modified&#039;:
			case &#039;post_parent&#039;:
			case &#039;post_type&#039;:
			case &#039;ID&#039;:
			case &#039;menu_order&#039;:
			case &#039;comment_count&#039;:
				$orderby_clause = &quot;{$wpdb-&gt;posts}.{$orderby}&quot;;
				break;
			case &#039;rand&#039;:
				$orderby_clause = &#039;RAND()&#039;;
				break;
			case $primary_meta_key:
			case &#039;meta_value&#039;:
				if ( ! empty( $primary_meta_query[&#039;type&#039;] ) ) {
					$orderby_clause = &quot;CAST({$primary_meta_query[&#039;alias&#039;]}.meta_value AS {$primary_meta_query[&#039;cast&#039;]})&quot;;
				} else {
					$orderby_clause = &quot;{$primary_meta_query[&#039;alias&#039;]}.meta_value&quot;;
				}
				break;
			case &#039;meta_value_num&#039;:
				$orderby_clause = &quot;{$primary_meta_query[&#039;alias&#039;]}.meta_value+0&quot;;
				break;
			case &#039;post__in&#039;:
				if ( ! empty( $this-&gt;query_vars[&#039;post__in&#039;] ) ) {
					$orderby_clause = &quot;FIELD({$wpdb-&gt;posts}.ID,&quot; . implode( &#039;,&#039;, array_map( &#039;absint&#039;, $this-&gt;query_vars[&#039;post__in&#039;] ) ) . &#039;)&#039;;
				}
				break;
			case &#039;post_parent__in&#039;:
				if ( ! empty( $this-&gt;query_vars[&#039;post_parent__in&#039;] ) ) {
					$orderby_clause = &quot;FIELD( {$wpdb-&gt;posts}.post_parent,&quot; . implode( &#039;, &#039;, array_map( &#039;absint&#039;, $this-&gt;query_vars[&#039;post_parent__in&#039;] ) ) . &#039; )&#039;;
				}
				break;
			case &#039;post_name__in&#039;:
				if ( ! empty( $this-&gt;query_vars[&#039;post_name__in&#039;] ) ) {
					$post_name__in        = array_map( &#039;sanitize_title_for_query&#039;, $this-&gt;query_vars[&#039;post_name__in&#039;] );
					$post_name__in_string = &quot;&#039;&quot; . implode( &quot;&#039;,&#039;&quot;, $post_name__in ) . &quot;&#039;&quot;;
					$orderby_clause       = &quot;FIELD( {$wpdb-&gt;posts}.post_name,&quot; . $post_name__in_string . &#039; )&#039;;
				}
				break;
			default:
				if ( array_key_exists( $orderby, $meta_clauses ) ) {
					// $orderby corresponds to a meta_query clause.
					$meta_clause    = $meta_clauses[ $orderby ];
					$orderby_clause = &quot;CAST({$meta_clause[&#039;alias&#039;]}.meta_value AS {$meta_clause[&#039;cast&#039;]})&quot;;
				} elseif ( $rand_with_seed ) {
					$orderby_clause = $orderby;
				} else {
					// Default: order by post field.
					$orderby_clause = &quot;{$wpdb-&gt;posts}.post_&quot; . sanitize_key( $orderby );
				}

				break;
		}

		return $orderby_clause;
	}

	/**
	 * Parse an &#039;order&#039; query variable and cast it to ASC or DESC as necessary.
	 *
	 * @since 4.0.0
	 *
	 * @param string $order The &#039;order&#039; query variable.
	 * @return string The sanitized &#039;order&#039; query variable.
	 */
	protected function parse_order( $order ) {
		if ( ! is_string( $order ) || empty( $order ) ) {
			return &#039;DESC&#039;;
		}

		if ( &#039;ASC&#039; === strtoupper( $order ) ) {
			return &#039;ASC&#039;;
		} else {
			return &#039;DESC&#039;;
		}
	}

	/**
	 * Sets the 404 property and saves whether query is feed.
	 *
	 * @since 2.0.0
	 */
	public function set_404() {
		$is_feed = $this-&gt;is_feed;

		$this-&gt;init_query_flags();
		$this-&gt;is_404 = true;

		$this-&gt;is_feed = $is_feed;

		/**
		 * Fires after a 404 is triggered.
		 *
		 * @since 5.5.0
		 *
		 * @param WP_Query $query The WP_Query instance (passed by reference).
		 */
		do_action_ref_array( &#039;set_404&#039;, array( $this ) );
	}

	/**
	 * Retrieves the value of a query variable.
	 *
	 * @since 1.5.0
	 * @since 3.9.0 The `$default_value` argument was introduced.
	 *
	 * @param string $query_var     Query variable key.
	 * @param mixed  $default_value Optional. Value to return if the query variable is not set.
	 *                              Default empty string.
	 * @return mixed Contents of the query variable.
	 */
	public function get( $query_var, $default_value = &#039;&#039; ) {
		return $this-&gt;query_vars[ $query_var ] ?? $default_value;
	}

	/**
	 * Sets the value of a query variable.
	 *
	 * @since 1.5.0
	 *
	 * @param string $query_var Query variable key.
	 * @param mixed  $value     Query variable value.
	 */
	public function set( $query_var, $value ) {
		$this-&gt;query_vars[ $query_var ] = $value;
	}

	/**
	 * Retrieves an array of posts based on query variables.
	 *
	 * There are a few filters and actions that can be used to modify the post
	 * database query.
	 *
	 * @since 1.5.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @return WP_Post[]|int[] Array of post objects or post IDs.
	 */
	public function get_posts() {
		global $wpdb;

		$this-&gt;parse_query();

		/**
		 * Fires after the query variable object is created, but before the actual query is run.
		 *
		 * Note: If using conditional tags, use the method versions within the passed instance
		 * (e.g. `$query-&gt;is_main_query()` instead of `is_main_query()`). This is because the functions
		 * like `is_main_query()` test against the global `$wp_query` instance, not the passed one.
		 *
		 * @since 2.0.0
		 *
		 * @param WP_Query $query The WP_Query instance (passed by reference).
		 */
		do_action_ref_array( &#039;pre_get_posts&#039;, array( &amp;$this ) );

		// Locally scoped reference for easy of use.
		$query_vars = &amp;$this-&gt;query_vars;

		// Fill again in case &#039;pre_get_posts&#039; unset some vars.
		$query_vars = $this-&gt;fill_query_vars( $query_vars );

		/**
		 * Filters whether an attachment query should include filenames or not.
		 *
		 * @since 6.0.3
		 *
		 * @param bool $allow_query_attachment_by_filename Whether or not to include filenames.
		 */
		$this-&gt;allow_query_attachment_by_filename = apply_filters( &#039;wp_allow_query_attachment_by_filename&#039;, false );
		remove_all_filters( &#039;wp_allow_query_attachment_by_filename&#039; );

		// Parse meta query.
		$this-&gt;meta_query = new WP_Meta_Query();
		$this-&gt;meta_query-&gt;parse_query_vars( $query_vars );

		// Set a flag if a &#039;pre_get_posts&#039; hook changed the query vars.
		$hash = md5( serialize( $this-&gt;query_vars ) );
		if ( $hash !== $this-&gt;query_vars_hash ) {
			$this-&gt;query_vars_changed = true;
			$this-&gt;query_vars_hash    = $hash;
		}
		unset( $hash );

		// First let&#039;s clear some variables.
		$distinct         = &#039;&#039;;
		$whichauthor      = &#039;&#039;;
		$whichmimetype    = &#039;&#039;;
		$where            = &#039;&#039;;
		$limits           = &#039;&#039;;
		$join             = &#039;&#039;;
		$search           = &#039;&#039;;
		$groupby          = &#039;&#039;;
		$post_status_join = false;
		$page             = 1;

		if ( isset( $query_vars[&#039;caller_get_posts&#039;] ) ) {
			_deprecated_argument(
				&#039;WP_Query&#039;,
				&#039;3.1.0&#039;,
				sprintf(
					/* translators: 1: caller_get_posts, 2: ignore_sticky_posts */
					__( &#039;%1$s is deprecated. Use %2$s instead.&#039; ),
					&#039;&lt;code&gt;caller_get_posts&lt;/code&gt;&#039;,
					&#039;&lt;code&gt;ignore_sticky_posts&lt;/code&gt;&#039;
				)
			);

			if ( ! isset( $query_vars[&#039;ignore_sticky_posts&#039;] ) ) {
				$query_vars[&#039;ignore_sticky_posts&#039;] = $query_vars[&#039;caller_get_posts&#039;];
			}
		}

		if ( ! isset( $query_vars[&#039;ignore_sticky_posts&#039;] ) ) {
			$query_vars[&#039;ignore_sticky_posts&#039;] = false;
		}

		if ( ! isset( $query_vars[&#039;suppress_filters&#039;] ) ) {
			$query_vars[&#039;suppress_filters&#039;] = false;
		}

		if ( ! isset( $query_vars[&#039;cache_results&#039;] ) ) {
			$query_vars[&#039;cache_results&#039;] = true;
		}

		if ( ! isset( $query_vars[&#039;update_post_term_cache&#039;] ) ) {
			$query_vars[&#039;update_post_term_cache&#039;] = true;
		}

		if ( ! isset( $query_vars[&#039;update_menu_item_cache&#039;] ) ) {
			$query_vars[&#039;update_menu_item_cache&#039;] = false;
		}

		if ( ! isset( $query_vars[&#039;lazy_load_term_meta&#039;] ) ) {
			$query_vars[&#039;lazy_load_term_meta&#039;] = $query_vars[&#039;update_post_term_cache&#039;];
		} elseif ( $query_vars[&#039;lazy_load_term_meta&#039;] ) { // Lazy loading term meta only works if term caches are primed.
			$query_vars[&#039;update_post_term_cache&#039;] = true;
		}

		if ( ! isset( $query_vars[&#039;update_post_meta_cache&#039;] ) ) {
			$query_vars[&#039;update_post_meta_cache&#039;] = true;
		}

		if ( ! isset( $query_vars[&#039;post_type&#039;] ) ) {
			if ( $this-&gt;is_search ) {
				$query_vars[&#039;post_type&#039;] = &#039;any&#039;;
			} else {
				$query_vars[&#039;post_type&#039;] = &#039;&#039;;
			}
		}
		$post_type = $query_vars[&#039;post_type&#039;];
		if ( empty( $query_vars[&#039;posts_per_page&#039;] ) ) {
			$query_vars[&#039;posts_per_page&#039;] = get_option( &#039;posts_per_page&#039; );
		}
		if ( isset( $query_vars[&#039;showposts&#039;] ) &amp;&amp; $query_vars[&#039;showposts&#039;] ) {
			$query_vars[&#039;showposts&#039;]      = (int) $query_vars[&#039;showposts&#039;];
			$query_vars[&#039;posts_per_page&#039;] = $query_vars[&#039;showposts&#039;];
		}
		if ( ( isset( $query_vars[&#039;posts_per_archive_page&#039;] ) &amp;&amp; 0 != $query_vars[&#039;posts_per_archive_page&#039;] ) &amp;&amp; ( $this-&gt;is_archive || $this-&gt;is_search ) ) {
			$query_vars[&#039;posts_per_page&#039;] = $query_vars[&#039;posts_per_archive_page&#039;];
		}
		if ( ! isset( $query_vars[&#039;nopaging&#039;] ) ) {
			if ( -1 == $query_vars[&#039;posts_per_page&#039;] ) {
				$query_vars[&#039;nopaging&#039;] = true;
			} else {
				$query_vars[&#039;nopaging&#039;] = false;
			}
		}

		if ( $this-&gt;is_feed ) {
			// This overrides &#039;posts_per_page&#039;.
			if ( ! empty( $query_vars[&#039;posts_per_rss&#039;] ) ) {
				$query_vars[&#039;posts_per_page&#039;] = $query_vars[&#039;posts_per_rss&#039;];
			} else {
				$query_vars[&#039;posts_per_page&#039;] = get_option( &#039;posts_per_rss&#039; );
			}
			$query_vars[&#039;nopaging&#039;] = false;
		}

		$query_vars[&#039;posts_per_page&#039;] = (int) $query_vars[&#039;posts_per_page&#039;];
		if ( $query_vars[&#039;posts_per_page&#039;] &lt; -1 ) {
			$query_vars[&#039;posts_per_page&#039;] = abs( $query_vars[&#039;posts_per_page&#039;] );
		} elseif ( 0 === $query_vars[&#039;posts_per_page&#039;] ) {
			$query_vars[&#039;posts_per_page&#039;] = 1;
		}

		if ( ! isset( $query_vars[&#039;comments_per_page&#039;] ) || 0 == $query_vars[&#039;comments_per_page&#039;] ) {
			$query_vars[&#039;comments_per_page&#039;] = get_option( &#039;comments_per_page&#039; );
		}

		if ( $this-&gt;is_home &amp;&amp; ( empty( $this-&gt;query ) || &#039;true&#039; === $query_vars[&#039;preview&#039;] ) &amp;&amp; ( &#039;page&#039; === get_option( &#039;show_on_front&#039; ) ) &amp;&amp; get_option( &#039;page_on_front&#039; ) ) {
			$this-&gt;is_page         = true;
			$this-&gt;is_home         = false;
			$query_vars[&#039;page_id&#039;] = get_option( &#039;page_on_front&#039; );
		}

		if ( isset( $query_vars[&#039;page&#039;] ) ) {
			$query_vars[&#039;page&#039;] = is_scalar( $query_vars[&#039;page&#039;] ) ? absint( trim( $query_vars[&#039;page&#039;], &#039;/&#039; ) ) : 0;
		}

		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
		if ( isset( $query_vars[&#039;no_found_rows&#039;] ) ) {
			$query_vars[&#039;no_found_rows&#039;] = (bool) $query_vars[&#039;no_found_rows&#039;];
		} else {
			$query_vars[&#039;no_found_rows&#039;] = false;
		}

		switch ( $query_vars[&#039;fields&#039;] ) {
			case &#039;ids&#039;:
				$fields = &quot;{$wpdb-&gt;posts}.ID&quot;;
				break;
			case &#039;id=&gt;parent&#039;:
				$fields = &quot;{$wpdb-&gt;posts}.ID, {$wpdb-&gt;posts}.post_parent&quot;;
				break;
			case &#039;&#039;:
				/*
				 * Set the default to &#039;all&#039;.
				 *
				 * This is used in `WP_Query::the_post` to determine if the
				 * entire post object has been queried.
				 */
				$query_vars[&#039;fields&#039;] = &#039;all&#039;;
				// Falls through.
			default:
				$fields = &quot;{$wpdb-&gt;posts}.*&quot;;
		}

		if ( &#039;&#039; !== $query_vars[&#039;menu_order&#039;] ) {
			$where .= &quot; AND {$wpdb-&gt;posts}.menu_order = &quot; . $query_vars[&#039;menu_order&#039;];
		}
		// The &quot;m&quot; parameter is meant for months but accepts datetimes of varying specificity.
		if ( $query_vars[&#039;m&#039;] ) {
			$where .= &quot; AND YEAR({$wpdb-&gt;posts}.post_date)=&quot; . substr( $query_vars[&#039;m&#039;], 0, 4 );
			if ( strlen( $query_vars[&#039;m&#039;] ) &gt; 5 ) {
				$where .= &quot; AND MONTH({$wpdb-&gt;posts}.post_date)=&quot; . substr( $query_vars[&#039;m&#039;], 4, 2 );
			}
			if ( strlen( $query_vars[&#039;m&#039;] ) &gt; 7 ) {
				$where .= &quot; AND DAYOFMONTH({$wpdb-&gt;posts}.post_date)=&quot; . substr( $query_vars[&#039;m&#039;], 6, 2 );
			}
			if ( strlen( $query_vars[&#039;m&#039;] ) &gt; 9 ) {
				$where .= &quot; AND HOUR({$wpdb-&gt;posts}.post_date)=&quot; . substr( $query_vars[&#039;m&#039;], 8, 2 );
			}
			if ( strlen( $query_vars[&#039;m&#039;] ) &gt; 11 ) {
				$where .= &quot; AND MINUTE({$wpdb-&gt;posts}.post_date)=&quot; . substr( $query_vars[&#039;m&#039;], 10, 2 );
			}
			if ( strlen( $query_vars[&#039;m&#039;] ) &gt; 13 ) {
				$where .= &quot; AND SECOND({$wpdb-&gt;posts}.post_date)=&quot; . substr( $query_vars[&#039;m&#039;], 12, 2 );
			}
		}

		// Handle the other individual date parameters.
		$date_parameters = array();

		if ( &#039;&#039; !== $query_vars[&#039;hour&#039;] ) {
			$date_parameters[&#039;hour&#039;] = $query_vars[&#039;hour&#039;];
		}

		if ( &#039;&#039; !== $query_vars[&#039;minute&#039;] ) {
			$date_parameters[&#039;minute&#039;] = $query_vars[&#039;minute&#039;];
		}

		if ( &#039;&#039; !== $query_vars[&#039;second&#039;] ) {
			$date_parameters[&#039;second&#039;] = $query_vars[&#039;second&#039;];
		}

		if ( $query_vars[&#039;year&#039;] ) {
			$date_parameters[&#039;year&#039;] = $query_vars[&#039;year&#039;];
		}

		if ( $query_vars[&#039;monthnum&#039;] ) {
			$date_parameters[&#039;monthnum&#039;] = $query_vars[&#039;monthnum&#039;];
		}

		if ( $query_vars[&#039;w&#039;] ) {
			$date_parameters[&#039;week&#039;] = $query_vars[&#039;w&#039;];
		}

		if ( $query_vars[&#039;day&#039;] ) {
			$date_parameters[&#039;day&#039;] = $query_vars[&#039;day&#039;];
		}

		if ( $date_parameters ) {
			$date_query = new WP_Date_Query( array( $date_parameters ) );
			$where     .= $date_query-&gt;get_sql();
		}
		unset( $date_parameters, $date_query );

		// Handle complex date queries.
		if ( ! empty( $query_vars[&#039;date_query&#039;] ) ) {
			$this-&gt;date_query = new WP_Date_Query( $query_vars[&#039;date_query&#039;] );
			$where           .= $this-&gt;date_query-&gt;get_sql();
		}

		// If we&#039;ve got a post_type AND it&#039;s not &quot;any&quot; post_type.
		if ( ! empty( $query_vars[&#039;post_type&#039;] ) &amp;&amp; &#039;any&#039; !== $query_vars[&#039;post_type&#039;] ) {
			foreach ( (array) $query_vars[&#039;post_type&#039;] as $_post_type ) {
				$ptype_obj = get_post_type_object( $_post_type );
				if ( ! $ptype_obj || ! $ptype_obj-&gt;query_var || empty( $query_vars[ $ptype_obj-&gt;query_var ] ) ) {
					continue;
				}

				if ( ! $ptype_obj-&gt;hierarchical ) {
					// Non-hierarchical post types can directly use &#039;name&#039;.
					$query_vars[&#039;name&#039;] = $query_vars[ $ptype_obj-&gt;query_var ];
				} else {
					// Hierarchical post types will operate through &#039;pagename&#039;.
					$query_vars[&#039;pagename&#039;] = $query_vars[ $ptype_obj-&gt;query_var ];
					$query_vars[&#039;name&#039;]     = &#039;&#039;;
				}

				// Only one request for a slug is possible, this is why name &amp; pagename are overwritten above.
				break;
			} // End foreach.
			unset( $ptype_obj );
		}

		if ( &#039;&#039; !== $query_vars[&#039;title&#039;] ) {
			$where .= $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.post_title = %s&quot;, stripslashes( $query_vars[&#039;title&#039;] ) );
		}

		// Parameters related to &#039;post_name&#039;.
		if ( &#039;&#039; !== $query_vars[&#039;name&#039;] ) {
			$query_vars[&#039;name&#039;] = sanitize_title_for_query( $query_vars[&#039;name&#039;] );
			$where             .= &quot; AND {$wpdb-&gt;posts}.post_name = &#039;&quot; . $query_vars[&#039;name&#039;] . &quot;&#039;&quot;;
		} elseif ( &#039;&#039; !== $query_vars[&#039;pagename&#039;] ) {
			if ( isset( $this-&gt;queried_object_id ) ) {
				$reqpage = $this-&gt;queried_object_id;
			} else {
				if ( &#039;page&#039; !== $query_vars[&#039;post_type&#039;] ) {
					foreach ( (array) $query_vars[&#039;post_type&#039;] as $_post_type ) {
						$ptype_obj = get_post_type_object( $_post_type );
						if ( ! $ptype_obj || ! $ptype_obj-&gt;hierarchical ) {
							continue;
						}

						$reqpage = get_page_by_path( $query_vars[&#039;pagename&#039;], OBJECT, $_post_type );
						if ( $reqpage ) {
							break;
						}
					}
					unset( $ptype_obj );
				} else {
					$reqpage = get_page_by_path( $query_vars[&#039;pagename&#039;] );
				}
				if ( ! empty( $reqpage ) ) {
					$reqpage = $reqpage-&gt;ID;
				} else {
					$reqpage = 0;
				}
			}

			$page_for_posts = get_option( &#039;page_for_posts&#039; );
			if ( ( &#039;page&#039; !== get_option( &#039;show_on_front&#039; ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) {
				$query_vars[&#039;pagename&#039;] = sanitize_title_for_query( wp_basename( $query_vars[&#039;pagename&#039;] ) );
				$query_vars[&#039;name&#039;]     = $query_vars[&#039;pagename&#039;];
				$where                 .= &quot; AND ({$wpdb-&gt;posts}.ID = &#039;$reqpage&#039;)&quot;;
				$reqpage_obj            = get_post( $reqpage );
				if ( is_object( $reqpage_obj ) &amp;&amp; &#039;attachment&#039; === $reqpage_obj-&gt;post_type ) {
					$this-&gt;is_attachment         = true;
					$post_type                   = &#039;attachment&#039;;
					$query_vars[&#039;post_type&#039;]     = &#039;attachment&#039;;
					$this-&gt;is_page               = true;
					$query_vars[&#039;attachment_id&#039;] = $reqpage;
				}
			}
		} elseif ( &#039;&#039; !== $query_vars[&#039;attachment&#039;] ) {
			$query_vars[&#039;attachment&#039;] = sanitize_title_for_query( wp_basename( $query_vars[&#039;attachment&#039;] ) );
			$query_vars[&#039;name&#039;]       = $query_vars[&#039;attachment&#039;];
			$where                   .= &quot; AND {$wpdb-&gt;posts}.post_name = &#039;&quot; . $query_vars[&#039;attachment&#039;] . &quot;&#039;&quot;;
		} elseif ( is_array( $query_vars[&#039;post_name__in&#039;] ) &amp;&amp; ! empty( $query_vars[&#039;post_name__in&#039;] ) ) {
			$query_vars[&#039;post_name__in&#039;] = array_map( &#039;sanitize_title_for_query&#039;, $query_vars[&#039;post_name__in&#039;] );
			// Duplicate array before sorting to allow for the orderby clause.
			$post_name__in_for_where = array_unique( $query_vars[&#039;post_name__in&#039;] );
			sort( $post_name__in_for_where );
			$post_name__in = &quot;&#039;&quot; . implode( &quot;&#039;,&#039;&quot;, $post_name__in_for_where ) . &quot;&#039;&quot;;
			$where        .= &quot; AND {$wpdb-&gt;posts}.post_name IN ($post_name__in)&quot;;
		}

		// If an attachment is requested by number, let it supersede any post number.
		if ( $query_vars[&#039;attachment_id&#039;] ) {
			$query_vars[&#039;p&#039;] = absint( $query_vars[&#039;attachment_id&#039;] );
		}

		// If a post number is specified, load that post.
		if ( $query_vars[&#039;p&#039;] ) {
			$where .= &quot; AND {$wpdb-&gt;posts}.ID = &quot; . $query_vars[&#039;p&#039;];
		} elseif ( $query_vars[&#039;post__in&#039;] ) {
			// Duplicate array before sorting to allow for the orderby clause.
			$post__in_for_where = $query_vars[&#039;post__in&#039;];
			$post__in_for_where = array_unique( array_map( &#039;absint&#039;, $post__in_for_where ) );
			sort( $post__in_for_where );
			$post__in = implode( &#039;,&#039;, array_map( &#039;absint&#039;, $post__in_for_where ) );
			$where   .= &quot; AND {$wpdb-&gt;posts}.ID IN ($post__in)&quot;;
		} elseif ( $query_vars[&#039;post__not_in&#039;] ) {
			sort( $query_vars[&#039;post__not_in&#039;] );
			$post__not_in = implode( &#039;,&#039;, array_map( &#039;absint&#039;, $query_vars[&#039;post__not_in&#039;] ) );
			$where       .= &quot; AND {$wpdb-&gt;posts}.ID NOT IN ($post__not_in)&quot;;
		}

		if ( is_numeric( $query_vars[&#039;post_parent&#039;] ) ) {
			$where .= $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.post_parent = %d &quot;, $query_vars[&#039;post_parent&#039;] );
		} elseif ( $query_vars[&#039;post_parent__in&#039;] ) {
			// Duplicate array before sorting to allow for the orderby clause.
			$post_parent__in_for_where = $query_vars[&#039;post_parent__in&#039;];
			$post_parent__in_for_where = array_unique( array_map( &#039;absint&#039;, $post_parent__in_for_where ) );
			sort( $post_parent__in_for_where );
			$post_parent__in = implode( &#039;,&#039;, array_map( &#039;absint&#039;, $post_parent__in_for_where ) );
			$where          .= &quot; AND {$wpdb-&gt;posts}.post_parent IN ($post_parent__in)&quot;;
		} elseif ( $query_vars[&#039;post_parent__not_in&#039;] ) {
			sort( $query_vars[&#039;post_parent__not_in&#039;] );
			$post_parent__not_in = implode( &#039;,&#039;, array_map( &#039;absint&#039;, $query_vars[&#039;post_parent__not_in&#039;] ) );
			$where              .= &quot; AND {$wpdb-&gt;posts}.post_parent NOT IN ($post_parent__not_in)&quot;;
		}

		if ( $query_vars[&#039;page_id&#039;] ) {
			if ( ( &#039;page&#039; !== get_option( &#039;show_on_front&#039; ) ) || ( get_option( &#039;page_for_posts&#039; ) != $query_vars[&#039;page_id&#039;] ) ) {
				$query_vars[&#039;p&#039;] = $query_vars[&#039;page_id&#039;];
				$where           = &quot; AND {$wpdb-&gt;posts}.ID = &quot; . $query_vars[&#039;page_id&#039;];
			}
		}

		// If a search pattern is specified, load the posts that match.
		if ( strlen( $query_vars[&#039;s&#039;] ) ) {
			$search = $this-&gt;parse_search( $query_vars );
		}

		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the search SQL that is used in the WHERE clause of WP_Query.
			 *
			 * @since 3.0.0
			 *
			 * @param string   $search Search SQL for WHERE clause.
			 * @param WP_Query $query  The current WP_Query object.
			 */
			$search = apply_filters_ref_array( &#039;posts_search&#039;, array( $search, &amp;$this ) );
		}

		// Taxonomies.
		if ( ! $this-&gt;is_singular ) {
			$this-&gt;parse_tax_query( $query_vars );

			$clauses = $this-&gt;tax_query-&gt;get_sql( $wpdb-&gt;posts, &#039;ID&#039; );

			$join  .= $clauses[&#039;join&#039;];
			$where .= $clauses[&#039;where&#039;];
		}

		if ( $this-&gt;is_tax ) {
			if ( empty( $post_type ) ) {
				// Do a fully inclusive search for currently registered post types of queried taxonomies.
				$post_type  = array();
				$taxonomies = array_keys( $this-&gt;tax_query-&gt;queried_terms );
				foreach ( get_post_types( array( &#039;exclude_from_search&#039; =&gt; false ) ) as $pt ) {
					$object_taxonomies = &#039;attachment&#039; === $pt ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
					if ( array_intersect( $taxonomies, $object_taxonomies ) ) {
						$post_type[] = $pt;
					}
				}
				if ( ! $post_type ) {
					$post_type = &#039;any&#039;;
				} elseif ( count( $post_type ) === 1 ) {
					$post_type = $post_type[0];
				} else {
					// Sort post types to ensure same cache key generation.
					sort( $post_type );
				}

				$post_status_join = true;
			} elseif ( in_array( &#039;attachment&#039;, (array) $post_type, true ) ) {
				$post_status_join = true;
			}
		}

		/*
		 * Ensure that &#039;taxonomy&#039;, &#039;term&#039;, &#039;term_id&#039;, &#039;cat&#039;, and
		 * &#039;category_name&#039; vars are set for backward compatibility.
		 */
		if ( ! empty( $this-&gt;tax_query-&gt;queried_terms ) ) {

			/*
			 * Set &#039;taxonomy&#039;, &#039;term&#039;, and &#039;term_id&#039; to the
			 * first taxonomy other than &#039;post_tag&#039; or &#039;category&#039;.
			 */
			if ( ! isset( $query_vars[&#039;taxonomy&#039;] ) ) {
				foreach ( $this-&gt;tax_query-&gt;queried_terms as $queried_taxonomy =&gt; $queried_items ) {
					if ( empty( $queried_items[&#039;terms&#039;][0] ) ) {
						continue;
					}

					if ( ! in_array( $queried_taxonomy, array( &#039;category&#039;, &#039;post_tag&#039; ), true ) ) {
						$query_vars[&#039;taxonomy&#039;] = $queried_taxonomy;

						if ( &#039;slug&#039; === $queried_items[&#039;field&#039;] ) {
							$query_vars[&#039;term&#039;] = $queried_items[&#039;terms&#039;][0];
						} else {
							$query_vars[&#039;term_id&#039;] = $queried_items[&#039;terms&#039;][0];
						}

						// Take the first one we find.
						break;
					}
				}
			}

			// &#039;cat&#039;, &#039;category_name&#039;, &#039;tag_id&#039;.
			foreach ( $this-&gt;tax_query-&gt;queried_terms as $queried_taxonomy =&gt; $queried_items ) {
				if ( empty( $queried_items[&#039;terms&#039;][0] ) ) {
					continue;
				}

				if ( &#039;category&#039; === $queried_taxonomy ) {
					$the_cat = get_term_by( $queried_items[&#039;field&#039;], $queried_items[&#039;terms&#039;][0], &#039;category&#039; );
					if ( $the_cat ) {
						$this-&gt;set( &#039;cat&#039;, $the_cat-&gt;term_id );
						$this-&gt;set( &#039;category_name&#039;, $the_cat-&gt;slug );
					}
					unset( $the_cat );
				}

				if ( &#039;post_tag&#039; === $queried_taxonomy ) {
					$the_tag = get_term_by( $queried_items[&#039;field&#039;], $queried_items[&#039;terms&#039;][0], &#039;post_tag&#039; );
					if ( $the_tag ) {
						$this-&gt;set( &#039;tag_id&#039;, $the_tag-&gt;term_id );
					}
					unset( $the_tag );
				}
			}
		}

		if ( ! empty( $this-&gt;tax_query-&gt;queries ) || ! empty( $this-&gt;meta_query-&gt;queries ) || ! empty( $this-&gt;allow_query_attachment_by_filename ) ) {
			$groupby = &quot;{$wpdb-&gt;posts}.ID&quot;;
		}

		// Author/user stuff.

		if ( ! empty( $query_vars[&#039;author&#039;] ) &amp;&amp; &#039;0&#039; != $query_vars[&#039;author&#039;] ) {
			$query_vars[&#039;author&#039;] = wp_slash( &#039;&#039; . urldecode( $query_vars[&#039;author&#039;] ) );
			$authors              = array_unique( array_map( &#039;intval&#039;, preg_split( &#039;/[,\s]+/&#039;, $query_vars[&#039;author&#039;] ) ) );
			sort( $authors );
			foreach ( $authors as $author ) {
				$key                  = $author &gt; 0 ? &#039;author__in&#039; : &#039;author__not_in&#039;;
				$query_vars[ $key ][] = abs( $author );
			}
			$query_vars[&#039;author&#039;] = implode( &#039;,&#039;, $authors );
		}

		if ( ! empty( $query_vars[&#039;author__not_in&#039;] ) ) {
			$author__not_in_id_list = wp_parse_id_list( $query_vars[&#039;author__not_in&#039;] );
			if ( count( $author__not_in_id_list ) &gt; 0 ) {
				sort( $author__not_in_id_list );
				$where .= sprintf(
					&quot; AND {$wpdb-&gt;posts}.post_author NOT IN (%s) &quot;,
					implode( &#039;,&#039;, $author__not_in_id_list )
				);
				/** Update the query var for stable cache key generation in <a href="https://developer.wordpress.org/reference/classes/self/generate_cache_key/">self::generate_cache_key()</a>. */
				$query_vars[&#039;author__not_in&#039;] = $author__not_in_id_list;
			}
		} elseif ( ! empty( $query_vars[&#039;author__in&#039;] ) ) {
			if ( is_array( $query_vars[&#039;author__in&#039;] ) ) {
				$query_vars[&#039;author__in&#039;] = array_unique( array_map( &#039;absint&#039;, $query_vars[&#039;author__in&#039;] ) );
				sort( $query_vars[&#039;author__in&#039;] );
			}
			$author__in = implode( &#039;,&#039;, array_map( &#039;absint&#039;, array_unique( (array) $query_vars[&#039;author__in&#039;] ) ) );
			$where     .= &quot; AND {$wpdb-&gt;posts}.post_author IN ($author__in) &quot;;
		}

		// Author stuff for nice URLs.

		if ( &#039;&#039; !== $query_vars[&#039;author_name&#039;] ) {
			if ( str_contains( $query_vars[&#039;author_name&#039;], &#039;/&#039; ) ) {
				$author_name_parts = explode( &#039;/&#039;, $query_vars[&#039;author_name&#039;] );
				$last_part         = array_last( $author_name_parts );

				if ( $last_part ) {
					$query_vars[&#039;author_name&#039;] = $last_part; // No trailing slash.
				} else {
					$query_vars[&#039;author_name&#039;] = $author_name_parts[ count( $author_name_parts ) - 2 ]; // There was a trailing slash.
				}
			}
			$query_vars[&#039;author_name&#039;] = sanitize_title_for_query( $query_vars[&#039;author_name&#039;] );
			$query_vars[&#039;author&#039;]      = get_user_by( &#039;slug&#039;, $query_vars[&#039;author_name&#039;] );
			if ( $query_vars[&#039;author&#039;] ) {
				$query_vars[&#039;author&#039;] = $query_vars[&#039;author&#039;]-&gt;ID;
			}
			$whichauthor .= &quot; AND ({$wpdb-&gt;posts}.post_author = &quot; . absint( $query_vars[&#039;author&#039;] ) . &#039;)&#039;;
		}

		// Matching by comment count.
		if ( isset( $query_vars[&#039;comment_count&#039;] ) ) {
			// Numeric comment count is converted to array format.
			if ( is_numeric( $query_vars[&#039;comment_count&#039;] ) ) {
				$query_vars[&#039;comment_count&#039;] = array(
					&#039;value&#039; =&gt; (int) $query_vars[&#039;comment_count&#039;],
				);
			}

			if ( isset( $query_vars[&#039;comment_count&#039;][&#039;value&#039;] ) ) {
				$query_vars[&#039;comment_count&#039;] = array_merge(
					array(
						&#039;compare&#039; =&gt; &#039;=&#039;,
					),
					$query_vars[&#039;comment_count&#039;]
				);

				// Fallback for invalid compare operators is &#039;=&#039;.
				$compare_operators = array( &#039;=&#039;, &#039;!=&#039;, &#039;&gt;&#039;, &#039;&gt;=&#039;, &#039;&lt;&#039;, &#039;&lt;=&#039; );
				if ( ! in_array( $query_vars[&#039;comment_count&#039;][&#039;compare&#039;], $compare_operators, true ) ) {
					$query_vars[&#039;comment_count&#039;][&#039;compare&#039;] = &#039;=&#039;;
				}

				$where .= $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.comment_count {$query_vars[&#039;comment_count&#039;][&#039;compare&#039;]} %d&quot;, $query_vars[&#039;comment_count&#039;][&#039;value&#039;] );
			}
		}

		// MIME-Type stuff for attachment browsing.

		if ( isset( $query_vars[&#039;post_mime_type&#039;] ) &amp;&amp; &#039;&#039; !== $query_vars[&#039;post_mime_type&#039;] ) {
			$whichmimetype = wp_post_mime_type_where( $query_vars[&#039;post_mime_type&#039;], $wpdb-&gt;posts );
		}
		$where .= $search . $whichauthor . $whichmimetype;

		if ( ! empty( $this-&gt;allow_query_attachment_by_filename ) ) {
			$join .= &quot; LEFT JOIN {$wpdb-&gt;postmeta} AS sq1 ON ( {$wpdb-&gt;posts}.ID = sq1.post_id AND sq1.meta_key = &#039;_wp_attached_file&#039; )&quot;;
		}

		if ( ! empty( $this-&gt;meta_query-&gt;queries ) ) {
			$clauses = $this-&gt;meta_query-&gt;get_sql( &#039;post&#039;, $wpdb-&gt;posts, &#039;ID&#039;, $this );
			$join   .= $clauses[&#039;join&#039;];
			$where  .= $clauses[&#039;where&#039;];
		}

		$rand = ( isset( $query_vars[&#039;orderby&#039;] ) &amp;&amp; &#039;rand&#039; === $query_vars[&#039;orderby&#039;] );
		if ( ! isset( $query_vars[&#039;order&#039;] ) ) {
			$query_vars[&#039;order&#039;] = $rand ? &#039;&#039; : &#039;DESC&#039;;
		} else {
			$query_vars[&#039;order&#039;] = $rand ? &#039;&#039; : $this-&gt;parse_order( $query_vars[&#039;order&#039;] );
		}

		// These values of orderby should ignore the &#039;order&#039; parameter.
		$force_asc = array( &#039;post__in&#039;, &#039;post_name__in&#039;, &#039;post_parent__in&#039; );
		if ( isset( $query_vars[&#039;orderby&#039;] ) &amp;&amp; in_array( $query_vars[&#039;orderby&#039;], $force_asc, true ) ) {
			$query_vars[&#039;order&#039;] = &#039;&#039;;
		}

		// Order by.
		if ( empty( $query_vars[&#039;orderby&#039;] ) ) {
			/*
			 * Boolean false or empty array blanks out ORDER BY,
			 * while leaving the value unset or otherwise empty sets the default.
			 */
			if ( isset( $query_vars[&#039;orderby&#039;] ) &amp;&amp; ( is_array( $query_vars[&#039;orderby&#039;] ) || false === $query_vars[&#039;orderby&#039;] ) ) {
				$orderby = &#039;&#039;;
			} else {
				$orderby = &quot;{$wpdb-&gt;posts}.post_date &quot; . $query_vars[&#039;order&#039;];
			}
		} elseif ( &#039;none&#039; === $query_vars[&#039;orderby&#039;] ) {
			$orderby = &#039;&#039;;
		} else {
			$orderby_array = array();
			if ( is_array( $query_vars[&#039;orderby&#039;] ) ) {
				foreach ( $query_vars[&#039;orderby&#039;] as $_orderby =&gt; $order ) {
					$orderby = wp_slash( urldecode( $_orderby ) );
					$parsed  = $this-&gt;parse_orderby( $orderby );

					if ( ! $parsed ) {
						continue;
					}

					$orderby_array[] = $parsed . &#039; &#039; . $this-&gt;parse_order( $order );
				}
				$orderby = implode( &#039;, &#039;, $orderby_array );

			} else {
				$query_vars[&#039;orderby&#039;] = urldecode( $query_vars[&#039;orderby&#039;] );
				$query_vars[&#039;orderby&#039;] = wp_slash( $query_vars[&#039;orderby&#039;] );

				foreach ( explode( &#039; &#039;, $query_vars[&#039;orderby&#039;] ) as $i =&gt; $orderby ) {
					$parsed = $this-&gt;parse_orderby( $orderby );
					// Only allow certain values for safety.
					if ( ! $parsed ) {
						continue;
					}

					$orderby_array[] = $parsed;
				}
				$orderby = implode( &#039; &#039; . $query_vars[&#039;order&#039;] . &#039;, &#039;, $orderby_array );

				if ( empty( $orderby ) ) {
					$orderby = &quot;{$wpdb-&gt;posts}.post_date &quot; . $query_vars[&#039;order&#039;];
				} elseif ( ! empty( $query_vars[&#039;order&#039;] ) ) {
					$orderby .= &quot; {$query_vars[&#039;order&#039;]}&quot;;
				}
			}
		}

		// Order search results by relevance only when another &quot;orderby&quot; is not specified in the query.
		if ( ! empty( $query_vars[&#039;s&#039;] ) ) {
			$search_orderby = &#039;&#039;;
			if ( ! empty( $query_vars[&#039;search_orderby_title&#039;] ) &amp;&amp; ( empty( $query_vars[&#039;orderby&#039;] ) &amp;&amp; ! $this-&gt;is_feed ) || ( isset( $query_vars[&#039;orderby&#039;] ) &amp;&amp; &#039;relevance&#039; === $query_vars[&#039;orderby&#039;] ) ) {
				$search_orderby = $this-&gt;parse_search_order( $query_vars );
			}

			if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
				/**
				 * Filters the ORDER BY used when ordering search results.
				 *
				 * @since 3.7.0
				 *
				 * @param string   $search_orderby The ORDER BY clause.
				 * @param WP_Query $query          The current WP_Query instance.
				 */
				$search_orderby = apply_filters( &#039;posts_search_orderby&#039;, $search_orderby, $this );
			}

			if ( $search_orderby ) {
				$orderby = $orderby ? $search_orderby . &#039;, &#039; . $orderby : $search_orderby;
			}
		}

		if ( is_array( $post_type ) &amp;&amp; count( $post_type ) &gt; 1 ) {
			$post_type_cap = &#039;multiple_post_type&#039;;
		} else {
			if ( is_array( $post_type ) ) {
				$post_type = reset( $post_type );
			}
			$post_type_object = get_post_type_object( $post_type );
			if ( empty( $post_type_object ) ) {
				$post_type_cap = $post_type;
			}
		}

		if ( isset( $query_vars[&#039;post_password&#039;] ) ) {
			$where .= $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.post_password = %s&quot;, $query_vars[&#039;post_password&#039;] );
			if ( empty( $query_vars[&#039;perm&#039;] ) ) {
				$query_vars[&#039;perm&#039;] = &#039;readable&#039;;
			}
		} elseif ( isset( $query_vars[&#039;has_password&#039;] ) ) {
			$where .= sprintf( &quot; AND {$wpdb-&gt;posts}.post_password %s &#039;&#039;&quot;, $query_vars[&#039;has_password&#039;] ? &#039;!=&#039; : &#039;=&#039; );
		}

		if ( ! empty( $query_vars[&#039;comment_status&#039;] ) ) {
			$where .= $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.comment_status = %s &quot;, $query_vars[&#039;comment_status&#039;] );
		}

		if ( ! empty( $query_vars[&#039;ping_status&#039;] ) ) {
			$where .= $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.ping_status = %s &quot;, $query_vars[&#039;ping_status&#039;] );
		}

		$skip_post_status = false;
		if ( &#039;any&#039; === $post_type ) {
			$in_search_post_types = get_post_types( array( &#039;exclude_from_search&#039; =&gt; false ) );
			if ( empty( $in_search_post_types ) ) {
				$post_type_where  = &#039; AND 1=0 &#039;;
				$skip_post_status = true;
			} else {
				$post_type_where = &quot; AND {$wpdb-&gt;posts}.post_type IN (&#039;&quot; . implode( &quot;&#039;, &#039;&quot;, array_map( &#039;esc_sql&#039;, $in_search_post_types ) ) . &quot;&#039;)&quot;;
			}
		} elseif ( ! empty( $post_type ) &amp;&amp; is_array( $post_type ) ) {
			// Sort post types to ensure same cache key generation.
			sort( $post_type );
			$post_type_where = &quot; AND {$wpdb-&gt;posts}.post_type IN (&#039;&quot; . implode( &quot;&#039;, &#039;&quot;, esc_sql( $post_type ) ) . &quot;&#039;)&quot;;
		} elseif ( ! empty( $post_type ) ) {
			$post_type_where  = $wpdb-&gt;prepare( &quot; AND {$wpdb-&gt;posts}.post_type = %s&quot;, $post_type );
			$post_type_object = get_post_type_object( $post_type );
		} elseif ( $this-&gt;is_attachment ) {
			$post_type_where  = &quot; AND {$wpdb-&gt;posts}.post_type = &#039;attachment&#039;&quot;;
			$post_type_object = get_post_type_object( &#039;attachment&#039; );
		} elseif ( $this-&gt;is_page ) {
			$post_type_where  = &quot; AND {$wpdb-&gt;posts}.post_type = &#039;page&#039;&quot;;
			$post_type_object = get_post_type_object( &#039;page&#039; );
		} else {
			$post_type_where  = &quot; AND {$wpdb-&gt;posts}.post_type = &#039;post&#039;&quot;;
			$post_type_object = get_post_type_object( &#039;post&#039; );
		}

		$edit_cap = &#039;edit_post&#039;;
		$read_cap = &#039;read_post&#039;;

		if ( ! empty( $post_type_object ) ) {
			$edit_others_cap  = $post_type_object-&gt;cap-&gt;edit_others_posts;
			$read_private_cap = $post_type_object-&gt;cap-&gt;read_private_posts;
		} else {
			$edit_others_cap  = &#039;edit_others_&#039; . $post_type_cap . &#039;s&#039;;
			$read_private_cap = &#039;read_private_&#039; . $post_type_cap . &#039;s&#039;;
		}

		$user_id = get_current_user_id();

		$q_status = array();
		if ( $skip_post_status ) {
			$where .= $post_type_where;
		} elseif ( ! empty( $query_vars[&#039;post_status&#039;] ) ) {

			$where .= $post_type_where;

			$statuswheres = array();
			$q_status     = $query_vars[&#039;post_status&#039;];
			if ( ! is_array( $q_status ) ) {
				$q_status = explode( &#039;,&#039;, $q_status );
			}
			sort( $q_status );
			$r_status = array();
			$p_status = array();
			$e_status = array();
			if ( in_array( &#039;any&#039;, $q_status, true ) ) {
				foreach ( get_post_stati( array( &#039;exclude_from_search&#039; =&gt; true ) ) as $status ) {
					if ( ! in_array( $status, $q_status, true ) ) {
						$e_status[] = &quot;{$wpdb-&gt;posts}.post_status &lt;&gt; &#039;$status&#039;&quot;;
					}
				}
			} else {
				foreach ( get_post_stati() as $status ) {
					if ( in_array( $status, $q_status, true ) ) {
						if ( &#039;private&#039; === $status ) {
							$p_status[] = &quot;{$wpdb-&gt;posts}.post_status = &#039;$status&#039;&quot;;
						} else {
							$r_status[] = &quot;{$wpdb-&gt;posts}.post_status = &#039;$status&#039;&quot;;
						}
					}
				}
			}

			if ( empty( $query_vars[&#039;perm&#039;] ) || &#039;readable&#039; !== $query_vars[&#039;perm&#039;] ) {
				$r_status = array_merge( $r_status, $p_status );
				unset( $p_status );
			}

			if ( ! empty( $e_status ) ) {
				$statuswheres[] = &#039;(&#039; . implode( &#039; AND &#039;, $e_status ) . &#039;)&#039;;
			}
			if ( ! empty( $r_status ) ) {
				if ( ! empty( $query_vars[&#039;perm&#039;] ) &amp;&amp; &#039;editable&#039; === $query_vars[&#039;perm&#039;] &amp;&amp; ! current_user_can( $edit_others_cap ) ) {
					$statuswheres[] = &quot;({$wpdb-&gt;posts}.post_author = $user_id &quot; . &#039;AND (&#039; . implode( &#039; OR &#039;, $r_status ) . &#039;))&#039;;
				} else {
					$statuswheres[] = &#039;(&#039; . implode( &#039; OR &#039;, $r_status ) . &#039;)&#039;;
				}
			}
			if ( ! empty( $p_status ) ) {
				if ( ! empty( $query_vars[&#039;perm&#039;] ) &amp;&amp; &#039;readable&#039; === $query_vars[&#039;perm&#039;] &amp;&amp; ! current_user_can( $read_private_cap ) ) {
					$statuswheres[] = &quot;({$wpdb-&gt;posts}.post_author = $user_id &quot; . &#039;AND (&#039; . implode( &#039; OR &#039;, $p_status ) . &#039;))&#039;;
				} else {
					$statuswheres[] = &#039;(&#039; . implode( &#039; OR &#039;, $p_status ) . &#039;)&#039;;
				}
			}
			if ( $post_status_join ) {
				$join .= &quot; LEFT JOIN {$wpdb-&gt;posts} AS p2 ON ({$wpdb-&gt;posts}.post_parent = p2.ID) &quot;;
				foreach ( $statuswheres as $index =&gt; $statuswhere ) {
					$statuswheres[ $index ] = &quot;($statuswhere OR ({$wpdb-&gt;posts}.post_status = &#039;inherit&#039; AND &quot; . str_replace( $wpdb-&gt;posts, &#039;p2&#039;, $statuswhere ) . &#039;))&#039;;
				}
			}
			$where_status = implode( &#039; OR &#039;, $statuswheres );
			if ( ! empty( $where_status ) ) {
				$where .= &quot; AND ($where_status)&quot;;
			}
		} elseif ( ! $this-&gt;is_singular ) {
			if ( &#039;any&#039; === $post_type ) {
				$queried_post_types = get_post_types( array( &#039;exclude_from_search&#039; =&gt; false ) );
			} elseif ( is_array( $post_type ) ) {
				$queried_post_types = $post_type;
			} elseif ( ! empty( $post_type ) ) {
				$queried_post_types = array( $post_type );
			} else {
				$queried_post_types = array( &#039;post&#039; );
			}

			if ( ! empty( $queried_post_types ) ) {
				sort( $queried_post_types );
				$status_type_clauses = array();

				foreach ( $queried_post_types as $queried_post_type ) {

					$queried_post_type_object = get_post_type_object( $queried_post_type );

					$type_where = &#039;(&#039; . $wpdb-&gt;prepare( &quot;{$wpdb-&gt;posts}.post_type = %s AND (&quot;, $queried_post_type );

					// Public statuses.
					$public_statuses = get_post_stati( array( &#039;public&#039; =&gt; true ) );
					$status_clauses  = array();
					foreach ( $public_statuses as $public_status ) {
						$status_clauses[] = &quot;{$wpdb-&gt;posts}.post_status = &#039;$public_status&#039;&quot;;
					}
					$type_where .= implode( &#039; OR &#039;, $status_clauses );

					// Add protected states that should show in the admin all list.
					if ( $this-&gt;is_admin ) {
						$admin_all_statuses = get_post_stati(
							array(
								&#039;protected&#039;              =&gt; true,
								&#039;show_in_admin_all_list&#039; =&gt; true,
							)
						);
						foreach ( $admin_all_statuses as $admin_all_status ) {
							$type_where .= &quot; OR {$wpdb-&gt;posts}.post_status = &#039;$admin_all_status&#039;&quot;;
						}
					}

					// Add private states that are visible to current user.
					if ( is_user_logged_in() &amp;&amp; $queried_post_type_object instanceof WP_Post_Type ) {
						$read_private_cap = $queried_post_type_object-&gt;cap-&gt;read_private_posts;
						$private_statuses = get_post_stati( array( &#039;private&#039; =&gt; true ) );
						foreach ( $private_statuses as $private_status ) {
							$type_where .= current_user_can( $read_private_cap ) ? &quot; \nOR {$wpdb-&gt;posts}.post_status = &#039;$private_status&#039;&quot; : &quot; \nOR ({$wpdb-&gt;posts}.post_author = $user_id AND {$wpdb-&gt;posts}.post_status = &#039;$private_status&#039;)&quot;;
						}
					}

					$type_where .= &#039;))&#039;;

					$status_type_clauses[] = $type_where;
				}

				if ( ! empty( $status_type_clauses ) ) {
					$where .= &#039; AND (&#039; . implode( &#039; OR &#039;, $status_type_clauses ) . &#039;)&#039;;
				}
			} else {
				$where .= &#039; AND 1=0 &#039;;
			}
		} else {
			$where .= $post_type_where;
		}

		/*
		 * Apply filters on where and join prior to paging so that any
		 * manipulations to them are reflected in the paging by day queries.
		 */
		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the WHERE clause of the query.
			 *
			 * @since 1.5.0
			 *
			 * @param string   $where The WHERE clause of the query.
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			$where = apply_filters_ref_array( &#039;posts_where&#039;, array( $where, &amp;$this ) );

			/**
			 * Filters the JOIN clause of the query.
			 *
			 * @since 1.5.0
			 *
			 * @param string   $join  The JOIN clause of the query.
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			$join = apply_filters_ref_array( &#039;posts_join&#039;, array( $join, &amp;$this ) );
		}

		// Paging.
		if ( empty( $query_vars[&#039;nopaging&#039;] ) &amp;&amp; ! $this-&gt;is_singular ) {
			$page = absint( $query_vars[&#039;paged&#039;] );
			if ( ! $page ) {
				$page = 1;
			}

			// If &#039;offset&#039; is provided, it takes precedence over &#039;paged&#039;.
			if ( isset( $query_vars[&#039;offset&#039;] ) &amp;&amp; is_numeric( $query_vars[&#039;offset&#039;] ) ) {
				$query_vars[&#039;offset&#039;] = absint( $query_vars[&#039;offset&#039;] );
				$pgstrt               = $query_vars[&#039;offset&#039;] . &#039;, &#039;;
			} else {
				$pgstrt = absint( ( $page - 1 ) * $query_vars[&#039;posts_per_page&#039;] ) . &#039;, &#039;;
			}
			$limits = &#039;LIMIT &#039; . $pgstrt . $query_vars[&#039;posts_per_page&#039;];
		}

		// Comments feeds.
		if ( $this-&gt;is_comment_feed &amp;&amp; ! $this-&gt;is_singular ) {
			if ( $this-&gt;is_archive || $this-&gt;is_search ) {
				$cjoin    = &quot;JOIN {$wpdb-&gt;posts} ON ( {$wpdb-&gt;comments}.comment_post_ID = {$wpdb-&gt;posts}.ID ) $join &quot;;
				$cwhere   = &quot;WHERE comment_approved = &#039;1&#039; AND {$wpdb-&gt;comments}.comment_type != &#039;note&#039; $where&quot;;
				$cgroupby = &quot;{$wpdb-&gt;comments}.comment_id&quot;;
			} else { // Other non-singular, e.g. front.
				$cjoin    = &quot;JOIN {$wpdb-&gt;posts} ON ( {$wpdb-&gt;comments}.comment_post_ID = {$wpdb-&gt;posts}.ID )&quot;;
				$cwhere   = &quot;WHERE ( post_status = &#039;publish&#039; OR ( post_status = &#039;inherit&#039; AND post_type = &#039;attachment&#039; ) ) AND comment_approved = &#039;1&#039; AND {$wpdb-&gt;comments}.comment_type != &#039;note&#039;&quot;;
				$cgroupby = &#039;&#039;;
			}

			if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
				/**
				 * Filters the JOIN clause of the comments feed query before sending.
				 *
				 * @since 2.2.0
				 *
				 * @param string   $cjoin The JOIN clause of the query.
				 * @param WP_Query $query The WP_Query instance (passed by reference).
				 */
				$cjoin = apply_filters_ref_array( &#039;comment_feed_join&#039;, array( $cjoin, &amp;$this ) );

				/**
				 * Filters the WHERE clause of the comments feed query before sending.
				 *
				 * @since 2.2.0
				 *
				 * @param string   $cwhere The WHERE clause of the query.
				 * @param WP_Query $query  The WP_Query instance (passed by reference).
				 */
				$cwhere = apply_filters_ref_array( &#039;comment_feed_where&#039;, array( $cwhere, &amp;$this ) );

				/**
				 * Filters the GROUP BY clause of the comments feed query before sending.
				 *
				 * @since 2.2.0
				 *
				 * @param string   $cgroupby The GROUP BY clause of the query.
				 * @param WP_Query $query    The WP_Query instance (passed by reference).
				 */
				$cgroupby = apply_filters_ref_array( &#039;comment_feed_groupby&#039;, array( $cgroupby, &amp;$this ) );

				/**
				 * Filters the ORDER BY clause of the comments feed query before sending.
				 *
				 * @since 2.8.0
				 *
				 * @param string   $corderby The ORDER BY clause of the query.
				 * @param WP_Query $query    The WP_Query instance (passed by reference).
				 */
				$corderby = apply_filters_ref_array( &#039;comment_feed_orderby&#039;, array( &#039;comment_date_gmt DESC&#039;, &amp;$this ) );

				/**
				 * Filters the LIMIT clause of the comments feed query before sending.
				 *
				 * @since 2.8.0
				 *
				 * @param string   $climits The JOIN clause of the query.
				 * @param WP_Query $query   The WP_Query instance (passed by reference).
				 */
				$climits = apply_filters_ref_array( &#039;comment_feed_limits&#039;, array( &#039;LIMIT &#039; . get_option( &#039;posts_per_rss&#039; ), &amp;$this ) );
			}

			$cgroupby = ( ! empty( $cgroupby ) ) ? &#039;GROUP BY &#039; . $cgroupby : &#039;&#039;;
			$corderby = ( ! empty( $corderby ) ) ? &#039;ORDER BY &#039; . $corderby : &#039;&#039;;
			$climits  = ( ! empty( $climits ) ) ? $climits : &#039;&#039;;

			$comments_request = &quot;SELECT $distinct {$wpdb-&gt;comments}.comment_ID FROM {$wpdb-&gt;comments} $cjoin $cwhere $cgroupby $corderby $climits&quot;;

			$key          = md5( $comments_request );
			$last_changed = array(
				wp_cache_get_last_changed( &#039;comment&#039; ),
				wp_cache_get_last_changed( &#039;posts&#039; ),
			);

			$cache_key   = &quot;comment_feed:$key&quot;;
			$comment_ids = wp_cache_get_salted( $cache_key, &#039;comment-queries&#039;, $last_changed );
			if ( false === $comment_ids ) {
				$comment_ids = $wpdb-&gt;get_col( $comments_request );
				wp_cache_set_salted( $cache_key, $comment_ids, &#039;comment-queries&#039;, $last_changed );
			}
			_prime_comment_caches( $comment_ids );

			// Convert to WP_Comment.
			/** @var WP_Comment[] */
			$this-&gt;comments      = array_map( &#039;get_comment&#039;, $comment_ids );
			$this-&gt;comment_count = count( $this-&gt;comments );

			$post_ids = array();

			foreach ( $this-&gt;comments as $comment ) {
				$post_ids[] = (int) $comment-&gt;comment_post_ID;
			}

			$post_ids = implode( &#039;,&#039;, $post_ids );
			$join     = &#039;&#039;;
			if ( $post_ids ) {
				$where = &quot;AND {$wpdb-&gt;posts}.ID IN ($post_ids) &quot;;
			} else {
				$where = &#039;AND 0&#039;;
			}
		}

		$pieces = array( &#039;where&#039;, &#039;groupby&#039;, &#039;join&#039;, &#039;orderby&#039;, &#039;distinct&#039;, &#039;fields&#039;, &#039;limits&#039; );

		/*
		 * Apply post-paging filters on where and join. Only plugins that
		 * manipulate paging queries should use these hooks.
		 */
		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the WHERE clause of the query.
			 *
			 * Specifically for manipulating paging queries.
			 *
			 * @since 1.5.0
			 *
			 * @param string   $where The WHERE clause of the query.
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			$where = apply_filters_ref_array( &#039;posts_where_paged&#039;, array( $where, &amp;$this ) );

			/**
			 * Filters the GROUP BY clause of the query.
			 *
			 * @since 2.0.0
			 *
			 * @param string   $groupby The GROUP BY clause of the query.
			 * @param WP_Query $query   The WP_Query instance (passed by reference).
			 */
			$groupby = apply_filters_ref_array( &#039;posts_groupby&#039;, array( $groupby, &amp;$this ) );

			/**
			 * Filters the JOIN clause of the query.
			 *
			 * Specifically for manipulating paging queries.
			 *
			 * @since 1.5.0
			 *
			 * @param string   $join  The JOIN clause of the query.
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			$join = apply_filters_ref_array( &#039;posts_join_paged&#039;, array( $join, &amp;$this ) );

			/**
			 * Filters the ORDER BY clause of the query.
			 *
			 * @since 1.5.1
			 *
			 * @param string   $orderby The ORDER BY clause of the query.
			 * @param WP_Query $query   The WP_Query instance (passed by reference).
			 */
			$orderby = apply_filters_ref_array( &#039;posts_orderby&#039;, array( $orderby, &amp;$this ) );

			/**
			 * Filters the DISTINCT clause of the query.
			 *
			 * @since 2.1.0
			 *
			 * @param string   $distinct The DISTINCT clause of the query.
			 * @param WP_Query $query    The WP_Query instance (passed by reference).
			 */
			$distinct = apply_filters_ref_array( &#039;posts_distinct&#039;, array( $distinct, &amp;$this ) );

			/**
			 * Filters the LIMIT clause of the query.
			 *
			 * @since 2.1.0
			 *
			 * @param string   $limits The LIMIT clause of the query.
			 * @param WP_Query $query  The WP_Query instance (passed by reference).
			 */
			$limits = apply_filters_ref_array( &#039;post_limits&#039;, array( $limits, &amp;$this ) );

			/**
			 * Filters the SELECT clause of the query.
			 *
			 * @since 2.1.0
			 *
			 * @param string   $fields The SELECT clause of the query.
			 * @param WP_Query $query  The WP_Query instance (passed by reference).
			 */
			$fields = apply_filters_ref_array( &#039;posts_fields&#039;, array( $fields, &amp;$this ) );

			/**
			 * Filters all query clauses at once, for convenience.
			 *
			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
			 * fields (SELECT), and LIMIT clauses.
			 *
			 * @since 3.1.0
			 *
			 * @param string[] $clauses {
			 *     Associative array of the clauses for the query.
			 *
			 *     @type string $where    The WHERE clause of the query.
			 *     @type string $groupby  The GROUP BY clause of the query.
			 *     @type string $join     The JOIN clause of the query.
			 *     @type string $orderby  The ORDER BY clause of the query.
			 *     @type string $distinct The DISTINCT clause of the query.
			 *     @type string $fields   The SELECT clause of the query.
			 *     @type string $limits   The LIMIT clause of the query.
			 * }
			 * @param WP_Query $query   The WP_Query instance (passed by reference).
			 */
			$clauses = (array) apply_filters_ref_array( &#039;posts_clauses&#039;, array( compact( $pieces ), &amp;$this ) );

			$where    = $clauses[&#039;where&#039;] ?? &#039;&#039;;
			$groupby  = $clauses[&#039;groupby&#039;] ?? &#039;&#039;;
			$join     = $clauses[&#039;join&#039;] ?? &#039;&#039;;
			$orderby  = $clauses[&#039;orderby&#039;] ?? &#039;&#039;;
			$distinct = $clauses[&#039;distinct&#039;] ?? &#039;&#039;;
			$fields   = $clauses[&#039;fields&#039;] ?? &#039;&#039;;
			$limits   = $clauses[&#039;limits&#039;] ?? &#039;&#039;;
		}

		/**
		 * Fires to announce the query&#039;s current selection parameters.
		 *
		 * For use by caching plugins.
		 *
		 * @since 2.3.0
		 *
		 * @param string $selection The assembled selection query.
		 */
		do_action( &#039;posts_selection&#039;, $where . $groupby . $orderby . $limits . $join );

		/*
		 * Filters again for the benefit of caching plugins.
		 * Regular plugins should use the hooks above.
		 */
		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the WHERE clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $where The WHERE clause of the query.
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			$where = apply_filters_ref_array( &#039;posts_where_request&#039;, array( $where, &amp;$this ) );

			/**
			 * Filters the GROUP BY clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $groupby The GROUP BY clause of the query.
			 * @param WP_Query $query   The WP_Query instance (passed by reference).
			 */
			$groupby = apply_filters_ref_array( &#039;posts_groupby_request&#039;, array( $groupby, &amp;$this ) );

			/**
			 * Filters the JOIN clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $join  The JOIN clause of the query.
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			$join = apply_filters_ref_array( &#039;posts_join_request&#039;, array( $join, &amp;$this ) );

			/**
			 * Filters the ORDER BY clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $orderby The ORDER BY clause of the query.
			 * @param WP_Query $query   The WP_Query instance (passed by reference).
			 */
			$orderby = apply_filters_ref_array( &#039;posts_orderby_request&#039;, array( $orderby, &amp;$this ) );

			/**
			 * Filters the DISTINCT clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $distinct The DISTINCT clause of the query.
			 * @param WP_Query $query    The WP_Query instance (passed by reference).
			 */
			$distinct = apply_filters_ref_array( &#039;posts_distinct_request&#039;, array( $distinct, &amp;$this ) );

			/**
			 * Filters the SELECT clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $fields The SELECT clause of the query.
			 * @param WP_Query $query  The WP_Query instance (passed by reference).
			 */
			$fields = apply_filters_ref_array( &#039;posts_fields_request&#039;, array( $fields, &amp;$this ) );

			/**
			 * Filters the LIMIT clause of the query.
			 *
			 * For use by caching plugins.
			 *
			 * @since 2.5.0
			 *
			 * @param string   $limits The LIMIT clause of the query.
			 * @param WP_Query $query  The WP_Query instance (passed by reference).
			 */
			$limits = apply_filters_ref_array( &#039;post_limits_request&#039;, array( $limits, &amp;$this ) );

			/**
			 * Filters all query clauses at once, for convenience.
			 *
			 * For use by caching plugins.
			 *
			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
			 * fields (SELECT), and LIMIT clauses.
			 *
			 * @since 3.1.0
			 *
			 * @param string[] $clauses {
			 *     Associative array of the clauses for the query.
			 *
			 *     @type string $where    The WHERE clause of the query.
			 *     @type string $groupby  The GROUP BY clause of the query.
			 *     @type string $join     The JOIN clause of the query.
			 *     @type string $orderby  The ORDER BY clause of the query.
			 *     @type string $distinct The DISTINCT clause of the query.
			 *     @type string $fields   The SELECT clause of the query.
			 *     @type string $limits   The LIMIT clause of the query.
			 * }
			 * @param WP_Query $query  The WP_Query instance (passed by reference).
			 */
			$clauses = (array) apply_filters_ref_array( &#039;posts_clauses_request&#039;, array( compact( $pieces ), &amp;$this ) );

			$where    = $clauses[&#039;where&#039;] ?? &#039;&#039;;
			$groupby  = $clauses[&#039;groupby&#039;] ?? &#039;&#039;;
			$join     = $clauses[&#039;join&#039;] ?? &#039;&#039;;
			$orderby  = $clauses[&#039;orderby&#039;] ?? &#039;&#039;;
			$distinct = $clauses[&#039;distinct&#039;] ?? &#039;&#039;;
			$fields   = $clauses[&#039;fields&#039;] ?? &#039;&#039;;
			$limits   = $clauses[&#039;limits&#039;] ?? &#039;&#039;;
		}

		if ( ! empty( $groupby ) ) {
			$groupby = &#039;GROUP BY &#039; . $groupby;
		}
		if ( ! empty( $orderby ) ) {
			$orderby = &#039;ORDER BY &#039; . $orderby;
		}

		$found_rows = &#039;&#039;;
		if ( ! $query_vars[&#039;no_found_rows&#039;] &amp;&amp; ! empty( $limits ) ) {
			$found_rows = &#039;SQL_CALC_FOUND_ROWS&#039;;
		}

		/*
		 * Beginning of the string is on a new line to prevent leading whitespace.
		 *
		 * The additional indentation of subsequent lines is to ensure the SQL
		 * queries are identical to those generated when splitting queries. This
		 * improves caching of the query by ensuring the same cache key is
		 * generated for the same database queries functionally.
		 *
		 * See https://core.trac.wordpress.org/ticket/56841.
		 * See https://github.com/WordPress/wordpress-develop/pull/6393#issuecomment-2088217429
		 */
		$old_request =
			&quot;SELECT $found_rows $distinct $fields
					 FROM {$wpdb-&gt;posts} $join
					 WHERE 1=1 $where
					 $groupby
					 $orderby
					 $limits&quot;;

		$this-&gt;request = $old_request;

		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the completed SQL query before sending.
			 *
			 * @since 2.0.0
			 *
			 * @param string   $request The complete SQL query.
			 * @param WP_Query $query   The WP_Query instance (passed by reference).
			 */
			$this-&gt;request = apply_filters_ref_array( &#039;posts_request&#039;, array( $this-&gt;request, &amp;$this ) );
		}

		/**
		 * Filters the posts array before the query takes place.
		 *
		 * Return a non-null value to bypass WordPress&#039; default post queries.
		 *
		 * Filtering functions that require pagination information are encouraged to set
		 * the `found_posts` and `max_num_pages` properties of the WP_Query object,
		 * passed to the filter by reference. If WP_Query does not perform a database
		 * query, it will not have enough information to generate these values itself.
		 *
		 * @since 4.6.0
		 *
		 * @param WP_Post[]|int[]|null $posts Return an array of post data to short-circuit WP&#039;s query,
		 *                                    or null to allow WP to run its normal queries.
		 * @param WP_Query             $query The WP_Query instance (passed by reference).
		 */
		$this-&gt;posts = apply_filters_ref_array( &#039;posts_pre_query&#039;, array( null, &amp;$this ) );

		/*
		 * Ensure the ID database query is able to be cached.
		 *
		 * Random queries are expected to have unpredictable results and
		 * cannot be cached. Note the space before `RAND` in the string
		 * search, that to ensure against a collision with another
		 * function.
		 *
		 * If `$fields` has been modified by the `posts_fields`,
		 * `posts_fields_request`, `post_clauses` or `posts_clauses_request`
		 * filters, then caching is disabled to prevent caching collisions.
		 */
		$id_query_is_cacheable = ! str_contains( strtoupper( $orderby ), &#039; RAND(&#039; );

		$cacheable_field_values = array(
			&quot;{$wpdb-&gt;posts}.*&quot;,
			&quot;{$wpdb-&gt;posts}.ID, {$wpdb-&gt;posts}.post_parent&quot;,
			&quot;{$wpdb-&gt;posts}.ID&quot;,
		);

		if ( ! in_array( $fields, $cacheable_field_values, true ) ) {
			$id_query_is_cacheable = false;
		}

		$last_changed = (array) wp_cache_get_last_changed( &#039;posts&#039; );
		if ( ! empty( $this-&gt;tax_query-&gt;queries ) ) {
			$last_changed[] = wp_cache_get_last_changed( &#039;terms&#039; );
		}

		if ( $query_vars[&#039;cache_results&#039;] &amp;&amp; $id_query_is_cacheable ) {
			$new_request = str_replace( $fields, &quot;{$wpdb-&gt;posts}.*&quot;, $this-&gt;request );
			$cache_key   = $this-&gt;generate_cache_key( $query_vars, $new_request );

			$cache_found = false;
			if ( null === $this-&gt;posts ) {
				$cached_results = wp_cache_get_salted( $cache_key, &#039;post-queries&#039;, $last_changed );

				if ( $cached_results ) {
					$cache_found = true;
					/** @var int[] */
					$post_ids = array_map( &#039;intval&#039;, $cached_results[&#039;posts&#039;] );

					$this-&gt;post_count    = count( $post_ids );
					$this-&gt;found_posts   = $cached_results[&#039;found_posts&#039;];
					$this-&gt;max_num_pages = $cached_results[&#039;max_num_pages&#039;];

					if ( &#039;ids&#039; === $query_vars[&#039;fields&#039;] ) {
						$this-&gt;posts = $post_ids;

						return $this-&gt;posts;
					} elseif ( &#039;id=&gt;parent&#039; === $query_vars[&#039;fields&#039;] ) {
						_prime_post_parent_id_caches( $post_ids );

						$post_parent_cache_keys = array();
						foreach ( $post_ids as $post_id ) {
							$post_parent_cache_keys[] = &#039;post_parent:&#039; . (string) $post_id;
						}

						/** @var int[] */
						$post_parents = wp_cache_get_multiple( $post_parent_cache_keys, &#039;posts&#039; );

						foreach ( $post_parents as $cache_key =&gt; $post_parent ) {
							$obj              = new stdClass();
							$obj-&gt;ID          = (int) str_replace( &#039;post_parent:&#039;, &#039;&#039;, $cache_key );
							$obj-&gt;post_parent = (int) $post_parent;

							$this-&gt;posts[] = $obj;
						}

						return $post_parents;
					} else {
						_prime_post_caches( $post_ids, $query_vars[&#039;update_post_term_cache&#039;], $query_vars[&#039;update_post_meta_cache&#039;] );
						/** @var WP_Post[] */
						$this-&gt;posts = array_map( &#039;get_post&#039;, $post_ids );
					}
				}
			}
		}

		if ( &#039;ids&#039; === $query_vars[&#039;fields&#039;] ) {
			if ( null === $this-&gt;posts ) {
				$this-&gt;posts = $wpdb-&gt;get_col( $this-&gt;request );
			}

			/** @var int[] */
			$this-&gt;posts      = array_map( &#039;intval&#039;, $this-&gt;posts );
			$this-&gt;post_count = count( $this-&gt;posts );
			$this-&gt;set_found_posts( $query_vars, $limits );

			if ( $query_vars[&#039;cache_results&#039;] &amp;&amp; $id_query_is_cacheable ) {
				$cache_value = array(
					&#039;posts&#039;         =&gt; $this-&gt;posts,
					&#039;found_posts&#039;   =&gt; $this-&gt;found_posts,
					&#039;max_num_pages&#039; =&gt; $this-&gt;max_num_pages,
				);

				wp_cache_set_salted( $cache_key, $cache_value, &#039;post-queries&#039;, $last_changed );
			}

			return $this-&gt;posts;
		}

		if ( &#039;id=&gt;parent&#039; === $query_vars[&#039;fields&#039;] ) {
			if ( null === $this-&gt;posts ) {
				$this-&gt;posts = $wpdb-&gt;get_results( $this-&gt;request );
			}

			$this-&gt;post_count = count( $this-&gt;posts );
			$this-&gt;set_found_posts( $query_vars, $limits );

			/** @var int[] */
			$post_parents       = array();
			$post_ids           = array();
			$post_parents_cache = array();

			foreach ( $this-&gt;posts as $key =&gt; $post ) {
				$this-&gt;posts[ $key ]-&gt;ID          = (int) $post-&gt;ID;
				$this-&gt;posts[ $key ]-&gt;post_parent = (int) $post-&gt;post_parent;

				$post_parents[ (int) $post-&gt;ID ] = (int) $post-&gt;post_parent;
				$post_ids[]                      = (int) $post-&gt;ID;

				$post_parents_cache[ &#039;post_parent:&#039; . (string) $post-&gt;ID ] = (int) $post-&gt;post_parent;
			}
			// Prime post parent caches, so that on second run, there is not another database query.
			wp_cache_add_multiple( $post_parents_cache, &#039;posts&#039; );

			if ( $query_vars[&#039;cache_results&#039;] &amp;&amp; $id_query_is_cacheable ) {
				$cache_value = array(
					&#039;posts&#039;         =&gt; $post_ids,
					&#039;found_posts&#039;   =&gt; $this-&gt;found_posts,
					&#039;max_num_pages&#039; =&gt; $this-&gt;max_num_pages,
				);

				wp_cache_set_salted( $cache_key, $cache_value, &#039;post-queries&#039;, $last_changed );
			}

			return $post_parents;
		}

		$is_unfiltered_query = $old_request === $this-&gt;request &amp;&amp; &quot;{$wpdb-&gt;posts}.*&quot; === $fields;

		if ( null === $this-&gt;posts ) {
			$split_the_query = (
				$is_unfiltered_query
				&amp;&amp; (
					wp_using_ext_object_cache()
					|| ( ! empty( $limits ) &amp;&amp; $query_vars[&#039;posts_per_page&#039;] &lt; 500 )
				)
			);

			/**
			 * Filters whether to split the query.
			 *
			 * Splitting the query will cause it to fetch just the IDs of the found posts
			 * (and then individually fetch each post by ID), rather than fetching every
			 * complete row at once. One massive result vs. many small results.
			 *
			 * @since 3.4.0
			 * @since 6.6.0 Added the `$old_request` and `$clauses` parameters.
			 *
			 * @param bool     $split_the_query Whether or not to split the query.
			 * @param WP_Query $query           The WP_Query instance.
			 * @param string   $old_request     The complete SQL query before filtering.
			 * @param string[] $clauses {
			 *     Associative array of the clauses for the query.
			 *
			 *     @type string $where    The WHERE clause of the query.
			 *     @type string $groupby  The GROUP BY clause of the query.
			 *     @type string $join     The JOIN clause of the query.
			 *     @type string $orderby  The ORDER BY clause of the query.
			 *     @type string $distinct The DISTINCT clause of the query.
			 *     @type string $fields   The SELECT clause of the query.
			 *     @type string $limits   The LIMIT clause of the query.
			 * }
			 */
			$split_the_query = apply_filters( &#039;split_the_query&#039;, $split_the_query, $this, $old_request, compact( $pieces ) );

			if ( $split_the_query ) {
				// First get the IDs and then fill in the objects.

				// Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841.
				$this-&gt;request =
					&quot;SELECT $found_rows $distinct {$wpdb-&gt;posts}.ID
					 FROM {$wpdb-&gt;posts} $join
					 WHERE 1=1 $where
					 $groupby
					 $orderby
					 $limits&quot;;

				/**
				 * Filters the Post IDs SQL request before sending.
				 *
				 * @since 3.4.0
				 *
				 * @param string   $request The post ID request.
				 * @param WP_Query $query   The WP_Query instance.
				 */
				$this-&gt;request = apply_filters( &#039;posts_request_ids&#039;, $this-&gt;request, $this );

				$post_ids = $wpdb-&gt;get_col( $this-&gt;request );

				if ( $post_ids ) {
					$this-&gt;posts = $post_ids;
					$this-&gt;set_found_posts( $query_vars, $limits );
					_prime_post_caches( $post_ids, $query_vars[&#039;update_post_term_cache&#039;], $query_vars[&#039;update_post_meta_cache&#039;] );
				} else {
					$this-&gt;posts = array();
				}
			} else {
				$this-&gt;posts = $wpdb-&gt;get_results( $this-&gt;request );
				$this-&gt;set_found_posts( $query_vars, $limits );
			}
		}

		// Convert to WP_Post objects.
		if ( $this-&gt;posts ) {
			/** @var WP_Post[] */
			$this-&gt;posts = array_map( &#039;get_post&#039;, $this-&gt;posts );
		}

		$unfiltered_posts = $this-&gt;posts;

		if ( $query_vars[&#039;cache_results&#039;] &amp;&amp; $id_query_is_cacheable &amp;&amp; ! $cache_found ) {
			$post_ids = wp_list_pluck( $this-&gt;posts, &#039;ID&#039; );

			$cache_value = array(
				&#039;posts&#039;         =&gt; $post_ids,
				&#039;found_posts&#039;   =&gt; $this-&gt;found_posts,
				&#039;max_num_pages&#039; =&gt; $this-&gt;max_num_pages,
			);

			wp_cache_set_salted( $cache_key, $cache_value, &#039;post-queries&#039;, $last_changed );
		}

		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the raw post results array, prior to status checks.
			 *
			 * @since 2.3.0
			 *
			 * @param WP_Post[] $posts Array of post objects.
			 * @param WP_Query  $query The WP_Query instance (passed by reference).
			 */
			$this-&gt;posts = apply_filters_ref_array( &#039;posts_results&#039;, array( $this-&gt;posts, &amp;$this ) );
		}

		if ( ! empty( $this-&gt;posts ) &amp;&amp; $this-&gt;is_comment_feed &amp;&amp; $this-&gt;is_singular ) {
			/** This filter is documented in wp-includes/class-wp-query.php */
			$cjoin = apply_filters_ref_array( &#039;comment_feed_join&#039;, array( &#039;&#039;, &amp;$this ) );

			/** This filter is documented in wp-includes/class-wp-query.php */
			$cwhere = apply_filters_ref_array( &#039;comment_feed_where&#039;, array( &quot;WHERE comment_post_ID = &#039;{$this-&gt;posts[0]-&gt;ID}&#039; AND comment_approved = &#039;1&#039; AND {$wpdb-&gt;comments}.comment_type != &#039;note&#039;&quot;, &amp;$this ) );

			/** This filter is documented in wp-includes/class-wp-query.php */
			$cgroupby = apply_filters_ref_array( &#039;comment_feed_groupby&#039;, array( &#039;&#039;, &amp;$this ) );
			$cgroupby = ( ! empty( $cgroupby ) ) ? &#039;GROUP BY &#039; . $cgroupby : &#039;&#039;;

			/** This filter is documented in wp-includes/class-wp-query.php */
			$corderby = apply_filters_ref_array( &#039;comment_feed_orderby&#039;, array( &#039;comment_date_gmt DESC&#039;, &amp;$this ) );
			$corderby = ( ! empty( $corderby ) ) ? &#039;ORDER BY &#039; . $corderby : &#039;&#039;;

			/** This filter is documented in wp-includes/class-wp-query.php */
			$climits = apply_filters_ref_array( &#039;comment_feed_limits&#039;, array( &#039;LIMIT &#039; . get_option( &#039;posts_per_rss&#039; ), &amp;$this ) );

			$comments_request = &quot;SELECT {$wpdb-&gt;comments}.comment_ID FROM {$wpdb-&gt;comments} $cjoin $cwhere $cgroupby $corderby $climits&quot;;

			$comment_key          = md5( $comments_request );
			$comment_last_changed = wp_cache_get_last_changed( &#039;comment&#039; );

			$comment_cache_key = &quot;comment_feed:$comment_key&quot;;
			$comment_ids       = wp_cache_get_salted( $comment_cache_key, &#039;comment-queries&#039;, $comment_last_changed );
			if ( false === $comment_ids ) {
				$comment_ids = $wpdb-&gt;get_col( $comments_request );
				wp_cache_set_salted( $comment_cache_key, $comment_ids, &#039;comment-queries&#039;, $comment_last_changed );
			}
			_prime_comment_caches( $comment_ids );

			// Convert to WP_Comment.
			/** @var WP_Comment[] */
			$this-&gt;comments      = array_map( &#039;get_comment&#039;, $comment_ids );
			$this-&gt;comment_count = count( $this-&gt;comments );
		}

		// Check post status to determine if post should be displayed.
		if ( ! empty( $this-&gt;posts ) &amp;&amp; ( $this-&gt;is_single || $this-&gt;is_page ) ) {
			$status = get_post_status( $this-&gt;posts[0] );

			if ( &#039;attachment&#039; === $this-&gt;posts[0]-&gt;post_type &amp;&amp; 0 === (int) $this-&gt;posts[0]-&gt;post_parent ) {
				$this-&gt;is_page       = false;
				$this-&gt;is_single     = true;
				$this-&gt;is_attachment = true;
			}

			// If the post_status was specifically requested, let it pass through.
			if ( ! in_array( $status, $q_status, true ) ) {
				$post_status_obj = get_post_status_object( $status );

				if ( $post_status_obj &amp;&amp; ! $post_status_obj-&gt;public ) {
					if ( ! is_user_logged_in() ) {
						// User must be logged in to view unpublished posts.
						$this-&gt;posts = array();
					} else {
						if ( $post_status_obj-&gt;protected ) {
							// User must have edit permissions on the draft to preview.
							if ( ! current_user_can( $edit_cap, $this-&gt;posts[0]-&gt;ID ) ) {
								$this-&gt;posts = array();
							} else {
								$this-&gt;is_preview = true;
								if ( &#039;future&#039; !== $status ) {
									$this-&gt;posts[0]-&gt;post_date = current_time( &#039;mysql&#039; );
								}
							}
						} elseif ( $post_status_obj-&gt;private ) {
							if ( ! current_user_can( $read_cap, $this-&gt;posts[0]-&gt;ID ) ) {
								$this-&gt;posts = array();
							}
						} else {
							$this-&gt;posts = array();
						}
					}
				} elseif ( ! $post_status_obj ) {
					// Post status is not registered, assume it&#039;s not public.
					if ( ! current_user_can( $edit_cap, $this-&gt;posts[0]-&gt;ID ) ) {
						$this-&gt;posts = array();
					}
				}
			}

			if ( $this-&gt;is_preview &amp;&amp; $this-&gt;posts &amp;&amp; current_user_can( $edit_cap, $this-&gt;posts[0]-&gt;ID ) ) {
				/**
				 * Filters the single post for preview mode.
				 *
				 * @since 2.7.0
				 *
				 * @param WP_Post  $post_preview  The Post object.
				 * @param WP_Query $query         The WP_Query instance (passed by reference).
				 */
				$this-&gt;posts[0] = get_post( apply_filters_ref_array( &#039;the_preview&#039;, array( $this-&gt;posts[0], &amp;$this ) ) );
			}
		}

		// Put sticky posts at the top of the posts array.
		$sticky_posts = get_option( &#039;sticky_posts&#039; );
		if ( $this-&gt;is_home &amp;&amp; $page &lt;= 1 &amp;&amp; is_array( $sticky_posts ) &amp;&amp; ! empty( $sticky_posts ) &amp;&amp; ! $query_vars[&#039;ignore_sticky_posts&#039;] ) {
			$num_posts     = count( $this-&gt;posts );
			$sticky_offset = 0;
			// Loop over posts and relocate stickies to the front.
			for ( $i = 0; $i &lt; $num_posts; $i++ ) {
				if ( in_array( $this-&gt;posts[ $i ]-&gt;ID, $sticky_posts, true ) ) {
					$sticky_post = $this-&gt;posts[ $i ];
					// Remove sticky from current position.
					array_splice( $this-&gt;posts, $i, 1 );
					// Move to front, after other stickies.
					array_splice( $this-&gt;posts, $sticky_offset, 0, array( $sticky_post ) );
					// Increment the sticky offset. The next sticky will be placed at this offset.
					++$sticky_offset;
					// Remove post from sticky posts array.
					$offset = array_search( $sticky_post-&gt;ID, $sticky_posts, true );
					unset( $sticky_posts[ $offset ] );
				}
			}

			// If any posts have been excluded specifically, Ignore those that are sticky.
			if ( ! empty( $sticky_posts ) &amp;&amp; ! empty( $query_vars[&#039;post__not_in&#039;] ) ) {
				$sticky_posts = array_diff( $sticky_posts, $query_vars[&#039;post__not_in&#039;] );
			}

			// Fetch sticky posts that weren&#039;t in the query results.
			if ( ! empty( $sticky_posts ) ) {
				$stickies = get_posts(
					array(
						&#039;post__in&#039;               =&gt; $sticky_posts,
						&#039;post_type&#039;              =&gt; $post_type,
						&#039;post_status&#039;            =&gt; &#039;publish&#039;,
						&#039;posts_per_page&#039;         =&gt; count( $sticky_posts ),
						&#039;suppress_filters&#039;       =&gt; $query_vars[&#039;suppress_filters&#039;],
						&#039;cache_results&#039;          =&gt; $query_vars[&#039;cache_results&#039;],
						&#039;update_post_meta_cache&#039; =&gt; $query_vars[&#039;update_post_meta_cache&#039;],
						&#039;update_post_term_cache&#039; =&gt; $query_vars[&#039;update_post_term_cache&#039;],
						&#039;lazy_load_term_meta&#039;    =&gt; $query_vars[&#039;lazy_load_term_meta&#039;],
					)
				);

				foreach ( $stickies as $sticky_post ) {
					array_splice( $this-&gt;posts, $sticky_offset, 0, array( $sticky_post ) );
					++$sticky_offset;
				}
			}
		}

		if ( ! $query_vars[&#039;suppress_filters&#039;] ) {
			/**
			 * Filters the array of retrieved posts after they&#039;ve been fetched and
			 * internally processed.
			 *
			 * @since 1.5.0
			 *
			 * @param WP_Post[] $posts Array of post objects.
			 * @param WP_Query  $query The WP_Query instance (passed by reference).
			 */
			$this-&gt;posts = apply_filters_ref_array( &#039;the_posts&#039;, array( $this-&gt;posts, &amp;$this ) );
		}

		/*
		 * Ensure that any posts added/modified via one of the filters above are
		 * of the type WP_Post and are filtered.
		 */
		if ( $this-&gt;posts ) {
			$this-&gt;post_count = count( $this-&gt;posts );

			/** @var WP_Post[] */
			$this-&gt;posts = array_map( &#039;get_post&#039;, $this-&gt;posts );

			if ( $query_vars[&#039;cache_results&#039;] ) {
				if ( $is_unfiltered_query &amp;&amp; $unfiltered_posts === $this-&gt;posts ) {
					update_post_caches( $this-&gt;posts, $post_type, $query_vars[&#039;update_post_term_cache&#039;], $query_vars[&#039;update_post_meta_cache&#039;] );
				} else {
					$post_ids = wp_list_pluck( $this-&gt;posts, &#039;ID&#039; );
					_prime_post_caches( $post_ids, $query_vars[&#039;update_post_term_cache&#039;], $query_vars[&#039;update_post_meta_cache&#039;] );
				}
			}

			/** @var WP_Post */
			$this-&gt;post = reset( $this-&gt;posts );
		} else {
			$this-&gt;post_count = 0;
			$this-&gt;posts      = array();
		}

		if ( ! empty( $this-&gt;posts ) &amp;&amp; $query_vars[&#039;update_menu_item_cache&#039;] ) {
			update_menu_item_cache( $this-&gt;posts );
		}

		if ( $query_vars[&#039;lazy_load_term_meta&#039;] ) {
			wp_queue_posts_for_term_meta_lazyload( $this-&gt;posts );
		}

		return $this-&gt;posts;
	}

	/**
	 * Sets up the amount of found posts and the number of pages (if limit clause was used)
	 * for the current query.
	 *
	 * @since 3.5.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param array  $query_vars Query variables.
	 * @param string $limits     LIMIT clauses of the query.
	 */
	private function set_found_posts( $query_vars, $limits ) {
		global $wpdb;

		/*
		 * Bail if posts is an empty array. Continue if posts is an empty string,
		 * null, or false to accommodate caching plugins that fill posts later.
		 */
		if ( $query_vars[&#039;no_found_rows&#039;] || ( is_array( $this-&gt;posts ) &amp;&amp; ! $this-&gt;posts ) ) {
			return;
		}

		if ( ! empty( $limits ) ) {
			/**
			 * Filters the query to run for retrieving the found posts.
			 *
			 * @since 2.1.0
			 *
			 * @param string   $found_posts_query The query to run to find the found posts.
			 * @param WP_Query $query             The WP_Query instance (passed by reference).
			 */
			$found_posts_query = apply_filters_ref_array( &#039;found_posts_query&#039;, array( &#039;SELECT FOUND_ROWS()&#039;, &amp;$this ) );

			$this-&gt;found_posts = (int) $wpdb-&gt;get_var( $found_posts_query );
		} else {
			if ( is_array( $this-&gt;posts ) ) {
				$this-&gt;found_posts = count( $this-&gt;posts );
			} else {
				if ( null === $this-&gt;posts ) {
					$this-&gt;found_posts = 0;
				} else {
					$this-&gt;found_posts = 1;
				}
			}
		}

		/**
		 * Filters the number of found posts for the query.
		 *
		 * @since 2.1.0
		 *
		 * @param int      $found_posts The number of posts found.
		 * @param WP_Query $query       The WP_Query instance (passed by reference).
		 */
		$this-&gt;found_posts = (int) apply_filters_ref_array( &#039;found_posts&#039;, array( $this-&gt;found_posts, &amp;$this ) );

		if ( ! empty( $limits ) ) {
			$this-&gt;max_num_pages = (int) ceil( $this-&gt;found_posts / $query_vars[&#039;posts_per_page&#039;] );
		}
	}

	/**
	 * Sets up the next post and iterate current post index.
	 *
	 * @since 1.5.0
	 *
	 * @return WP_Post Next post.
	 */
	public function next_post() {

		++$this-&gt;current_post;

		/** @var WP_Post */
		$this-&gt;post = $this-&gt;posts[ $this-&gt;current_post ];
		return $this-&gt;post;
	}

	/**
	 * Sets up the current post.
	 *
	 * Retrieves the next post, sets up the post, sets the &#039;in the loop&#039;
	 * property to true.
	 *
	 * @since 1.5.0
	 *
	 * @global WP_Post $post Global post object.
	 */
	public function the_post() {
		global $post;

		if ( ! $this-&gt;in_the_loop ) {
			if ( &#039;all&#039; === $this-&gt;query_vars[&#039;fields&#039;] ) {
				// Full post objects queried.
				$post_objects = $this-&gt;posts;
			} else {
				if ( &#039;ids&#039; === $this-&gt;query_vars[&#039;fields&#039;] ) {
					// Post IDs queried.
					$post_ids = $this-&gt;posts;
				} else {
					// Only partial objects queried, need to prime the cache for the loop.
					$post_ids = array_reduce(
						$this-&gt;posts,
						function ( $carry, $post ) {
							if ( isset( $post-&gt;ID ) ) {
								$carry[] = $post-&gt;ID;
							}

							return $carry;
						},
						array()
					);
				}
				_prime_post_caches( $post_ids, $this-&gt;query_vars[&#039;update_post_term_cache&#039;], $this-&gt;query_vars[&#039;update_post_meta_cache&#039;] );
				$post_objects = array_map( &#039;get_post&#039;, $post_ids );
			}
			update_post_author_caches( $post_objects );
		}

		$this-&gt;in_the_loop = true;
		$this-&gt;before_loop = false;

		if ( -1 === $this-&gt;current_post ) { // Loop has just started.
			/**
			 * Fires once the loop is started.
			 *
			 * @since 2.0.0
			 *
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			do_action_ref_array( &#039;loop_start&#039;, array( &amp;$this ) );
		}

		$post = $this-&gt;next_post();

		// Ensure a full post object is available.
		if ( &#039;all&#039; !== $this-&gt;query_vars[&#039;fields&#039;] ) {
			if ( &#039;ids&#039; === $this-&gt;query_vars[&#039;fields&#039;] ) {
				// Post IDs queried.
				$post = get_post( $post );
			} elseif ( isset( $post-&gt;ID ) ) {
				/*
				 * Partial object queried.
				 *
				 * The post object was queried with a partial set of
				 * fields, populate the entire object for the loop.
				 */
				$post = get_post( $post-&gt;ID );
			}
		}

		// Set up the global post object for the loop.
		$this-&gt;setup_postdata( $post );
	}

	/**
	 * Determines whether there are more posts available in the loop.
	 *
	 * Calls the &#039;loop_end&#039; action when the loop is complete.
	 *
	 * @since 1.5.0
	 *
	 * @return bool True if posts are available, false if end of the loop.
	 */
	public function have_posts() {
		if ( $this-&gt;current_post + 1 &lt; $this-&gt;post_count ) {
			return true;
		} elseif ( $this-&gt;current_post + 1 === $this-&gt;post_count &amp;&amp; $this-&gt;post_count &gt; 0 ) {
			/**
			 * Fires once the loop has ended.
			 *
			 * @since 2.0.0
			 *
			 * @param WP_Query $query The WP_Query instance (passed by reference).
			 */
			do_action_ref_array( &#039;loop_end&#039;, array( &amp;$this ) );

			// Do some cleaning up after the loop.
			$this-&gt;rewind_posts();
		} elseif ( 0 === $this-&gt;post_count ) {
			$this-&gt;before_loop = false;

			/**
			 * Fires if no results are found in a post query.
			 *
			 * @since 4.9.0
			 *
			 * @param WP_Query $query The WP_Query instance.
			 */
			do_action( &#039;loop_no_results&#039;, $this );
		}

		$this-&gt;in_the_loop = false;
		return false;
	}

	/**
	 * Rewinds the posts and resets post index.
	 *
	 * @since 1.5.0
	 */
	public function rewind_posts() {
		$this-&gt;current_post = -1;
		if ( $this-&gt;post_count &gt; 0 ) {
			$this-&gt;post = $this-&gt;posts[0];
		}
	}

	/**
	 * Iterates current comment index and returns WP_Comment object.
	 *
	 * @since 2.2.0
	 *
	 * @return WP_Comment Comment object.
	 */
	public function next_comment() {
		++$this-&gt;current_comment;

		/** @var WP_Comment */
		$this-&gt;comment = $this-&gt;comments[ $this-&gt;current_comment ];
		return $this-&gt;comment;
	}

	/**
	 * Sets up the current comment.
	 *
	 * @since 2.2.0
	 *
	 * @global WP_Comment $comment Global comment object.
	 */
	public function the_comment() {
		global $comment;

		$comment = $this-&gt;next_comment();

		if ( 0 === $this-&gt;current_comment ) {
			/**
			 * Fires once the comment loop is started.
			 *
			 * @since 2.2.0
			 */
			do_action( &#039;comment_loop_start&#039; );
		}
	}

	/**
	 * Determines whether there are more comments available.
	 *
	 * Automatically rewinds comments when finished.
	 *
	 * @since 2.2.0
	 *
	 * @return bool True if comments are available, false if no more comments.
	 */
	public function have_comments() {
		if ( $this-&gt;current_comment + 1 &lt; $this-&gt;comment_count ) {
			return true;
		} elseif ( $this-&gt;current_comment + 1 === $this-&gt;comment_count ) {
			$this-&gt;rewind_comments();
		}

		return false;
	}

	/**
	 * Rewinds the comments, resets the comment index and comment to first.
	 *
	 * @since 2.2.0
	 */
	public function rewind_comments() {
		$this-&gt;current_comment = -1;
		if ( $this-&gt;comment_count &gt; 0 ) {
			$this-&gt;comment = $this-&gt;comments[0];
		}
	}

	/**
	 * Sets up the WordPress query by parsing query string.
	 *
	 * @since 1.5.0
	 *
	 * @see WP_Query::parse_query() for all available arguments.
	 *
	 * @param string|array $query URL query string or array of query arguments.
	 * @return WP_Post[]|int[] Array of post objects or post IDs.
	 *
	 * @phpstan-return (
	 *     $query is array{ fields: &#039;ids&#039;, ... } ? int[] : WP_Post[]
	 * )
	 */
	public function query( $query ) {
		$this-&gt;init();
		$this-&gt;query      = wp_parse_args( $query );
		$this-&gt;query_vars = $this-&gt;query;
		return $this-&gt;get_posts();
	}

	/**
	 * Retrieves the currently queried object.
	 *
	 * If queried object is not set, then the queried object will be set from
	 * the category, tag, taxonomy, posts page, single post, page, or author
	 * query variable. After it is set up, it will be returned.
	 *
	 * @since 1.5.0
	 *
	 * @return WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object.
	 */
	public function get_queried_object() {
		if ( isset( $this-&gt;queried_object ) ) {
			return $this-&gt;queried_object;
		}

		$this-&gt;queried_object    = null;
		$this-&gt;queried_object_id = null;

		if ( $this-&gt;is_category || $this-&gt;is_tag || $this-&gt;is_tax ) {
			if ( $this-&gt;is_category ) {
				$cat           = $this-&gt;get( &#039;cat&#039; );
				$category_name = $this-&gt;get( &#039;category_name&#039; );

				if ( $cat ) {
					$term = get_term( $cat, &#039;category&#039; );
				} elseif ( $category_name ) {
					$term = get_term_by( &#039;slug&#039;, $category_name, &#039;category&#039; );
				}
			} elseif ( $this-&gt;is_tag ) {
				$tag_id = $this-&gt;get( &#039;tag_id&#039; );
				$tag    = $this-&gt;get( &#039;tag&#039; );

				if ( $tag_id ) {
					$term = get_term( $tag_id, &#039;post_tag&#039; );
				} elseif ( $tag ) {
					$term = get_term_by( &#039;slug&#039;, $tag, &#039;post_tag&#039; );
				}
			} else {
				// For other tax queries, grab the first term from the first clause.
				if ( ! empty( $this-&gt;tax_query-&gt;queried_terms ) ) {
					$queried_taxonomies = array_keys( $this-&gt;tax_query-&gt;queried_terms );
					$matched_taxonomy   = reset( $queried_taxonomies );
					$query              = $this-&gt;tax_query-&gt;queried_terms[ $matched_taxonomy ];

					if ( ! empty( $query[&#039;terms&#039;] ) ) {
						if ( &#039;term_id&#039; === $query[&#039;field&#039;] ) {
							$term = get_term( reset( $query[&#039;terms&#039;] ), $matched_taxonomy );
						} else {
							$term = get_term_by( $query[&#039;field&#039;], reset( $query[&#039;terms&#039;] ), $matched_taxonomy );
						}
					}
				}
			}

			if ( ! empty( $term ) &amp;&amp; ! is_wp_error( $term ) ) {
				$this-&gt;queried_object    = $term;
				$this-&gt;queried_object_id = (int) $term-&gt;term_id;

				if ( $this-&gt;is_category &amp;&amp; &#039;category&#039; === $this-&gt;queried_object-&gt;taxonomy ) {
					_make_cat_compat( $this-&gt;queried_object );
				}
			}
		} elseif ( $this-&gt;is_post_type_archive ) {
			$post_type = $this-&gt;get( &#039;post_type&#039; );
			if ( is_array( $post_type ) ) {
				$post_type = reset( $post_type );
			}

			$this-&gt;queried_object = get_post_type_object( $post_type );
		} elseif ( $this-&gt;is_posts_page ) {
			$posts_page = get_post( get_option( &#039;page_for_posts&#039; ) );
			if ( $posts_page ) {
				$this-&gt;queried_object    = $posts_page;
				$this-&gt;queried_object_id = (int) $posts_page-&gt;ID;
			}
		} elseif ( $this-&gt;is_singular &amp;&amp; ! empty( $this-&gt;post ) ) {
			$this-&gt;queried_object    = $this-&gt;post;
			$this-&gt;queried_object_id = (int) $this-&gt;post-&gt;ID;
		} elseif ( $this-&gt;is_author ) {
			$author      = (int) $this-&gt;get( &#039;author&#039; );
			$author_name = $this-&gt;get( &#039;author_name&#039; );

			if ( $author ) {
				$this-&gt;queried_object_id = $author;
			} elseif ( $author_name ) {
				$user = get_user_by( &#039;slug&#039;, $author_name );
				if ( $user ) {
					$this-&gt;queried_object_id = $user-&gt;ID;
				}
			}

			if ( $this-&gt;queried_object_id ) {
				$user = get_userdata( $this-&gt;queried_object_id );
				if ( $user ) {
					$this-&gt;queried_object = $user;
				}
			}
		}

		return $this-&gt;queried_object;
	}

	/**
	 * Retrieves the ID of the currently queried object.
	 *
	 * @since 1.5.0
	 *
	 * @return int
	 */
	public function get_queried_object_id() {
		$this-&gt;get_queried_object();
		return $this-&gt;queried_object_id ?? 0;
	}

	/**
	 * Constructor.
	 *
	 * Sets up the WordPress query, if parameter is not empty.
	 *
	 * @since 1.5.0
	 *
	 * @see WP_Query::parse_query() for all available arguments.
	 *
	 * @param string|array $query URL query string or array of vars.
	 */
	public function __construct( $query = &#039;&#039; ) {
		if ( ! empty( $query ) ) {
			$this-&gt;query( $query );
		}
	}

	/**
	 * Makes private properties readable for backward compatibility.
	 *
	 * @since 4.0.0
	 *
	 * @param string $name Property to get.
	 * @return mixed Property.
	 */
	public function __get( $name ) {
		if ( in_array( $name, $this-&gt;compat_fields, true ) ) {
			return $this-&gt;$name;
		}
	}

	/**
	 * Makes private properties checkable for backward compatibility.
	 *
	 * @since 4.0.0
	 *
	 * @param string $name Property to check if set.
	 * @return bool Whether the property is set.
	 */
	public function __isset( $name ) {
		if ( in_array( $name, $this-&gt;compat_fields, true ) ) {
			return isset( $this-&gt;$name );
		}

		return false;
	}

	/**
	 * Makes private/protected methods readable for backward compatibility.
	 *
	 * @since 4.0.0
	 *
	 * @param string $name      Method to call.
	 * @param array  $arguments Arguments to pass when calling.
	 * @return mixed|false Return value of the callback, false otherwise.
	 */
	public function __call( $name, $arguments ) {
		if ( in_array( $name, $this-&gt;compat_methods, true ) ) {
			return $this-&gt;$name( ...$arguments );
		}
		return false;
	}

	/**
	 * Determines whether the query is for an existing archive page.
	 *
	 * Archive pages include category, tag, author, date, custom post type,
	 * and custom taxonomy based archives.
	 *
	 * @since 3.1.0
	 *
	 * @see WP_Query::is_category()
	 * @see WP_Query::is_tag()
	 * @see WP_Query::is_author()
	 * @see WP_Query::is_date()
	 * @see WP_Query::is_post_type_archive()
	 * @see WP_Query::is_tax()
	 *
	 * @return bool Whether the query is for an existing archive page.
	 */
	public function is_archive() {
		return (bool) $this-&gt;is_archive;
	}

	/**
	 * Determines whether the query is for an existing post type archive page.
	 *
	 * @since 3.1.0
	 *
	 * @param string|string[] $post_types Optional. Post type or array of posts types
	 *                                    to check against. Default empty.
	 * @return bool Whether the query is for an existing post type archive page.
	 */
	public function is_post_type_archive( $post_types = &#039;&#039; ) {
		if ( empty( $post_types ) || ! $this-&gt;is_post_type_archive ) {
			return (bool) $this-&gt;is_post_type_archive;
		}

		$post_type = $this-&gt;get( &#039;post_type&#039; );
		if ( is_array( $post_type ) ) {
			$post_type = reset( $post_type );
		}
		$post_type_object = get_post_type_object( $post_type );

		if ( ! $post_type_object ) {
			return false;
		}

		return in_array( $post_type_object-&gt;name, (array) $post_types, true );
	}

	/**
	 * Determines whether the query is for an existing attachment page.
	 *
	 * @since 3.1.0
	 *
	 * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such
	 *                                              to check against. Default empty.
	 * @return bool Whether the query is for an existing attachment page.
	 */
	public function is_attachment( $attachment = &#039;&#039; ) {
		if ( ! $this-&gt;is_attachment ) {
			return false;
		}

		if ( empty( $attachment ) ) {
			return true;
		}

		$attachment = array_map( &#039;strval&#039;, (array) $attachment );

		$post_obj = $this-&gt;get_queried_object();
		if ( ! $post_obj ) {
			return false;
		}

		if ( in_array( (string) $post_obj-&gt;ID, $attachment, true ) ) {
			return true;
		} elseif ( in_array( $post_obj-&gt;post_title, $attachment, true ) ) {
			return true;
		} elseif ( in_array( $post_obj-&gt;post_name, $attachment, true ) ) {
			return true;
		}
		return false;
	}

	/**
	 * Determines whether the query is for an existing author archive page.
	 *
	 * If the $author parameter is specified, this function will additionally
	 * check if the query is for one of the authors specified.
	 *
	 * @since 3.1.0
	 *
	 * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such
	 *                                          to check against. Default empty.
	 * @return bool Whether the query is for an existing author archive page.
	 */
	public function is_author( $author = &#039;&#039; ) {
		if ( ! $this-&gt;is_author ) {
			return false;
		}

		if ( empty( $author ) ) {
			return true;
		}

		$author_obj = $this-&gt;get_queried_object();
		if ( ! $author_obj ) {
			return false;
		}

		$author = array_map( &#039;strval&#039;, (array) $author );

		if ( in_array( (string) $author_obj-&gt;ID, $author, true ) ) {
			return true;
		} elseif ( in_array( $author_obj-&gt;nickname, $author, true ) ) {
			return true;
		} elseif ( in_array( $author_obj-&gt;user_nicename, $author, true ) ) {
			return true;
		}

		return false;
	}

	/**
	 * Determines whether the query is for an existing category archive page.
	 *
	 * If the $category parameter is specified, this function will additionally
	 * check if the query is for one of the categories specified.
	 *
	 * @since 3.1.0
	 *
	 * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such
	 *                                            to check against. Default empty.
	 * @return bool Whether the query is for an existing category archive page.
	 */
	public function is_category( $category = &#039;&#039; ) {
		if ( ! $this-&gt;is_category ) {
			return false;
		}

		if ( empty( $category ) ) {
			return true;
		}

		$cat_obj = $this-&gt;get_queried_object();
		if ( ! $cat_obj ) {
			return false;
		}

		$category = array_map( &#039;strval&#039;, (array) $category );

		if ( in_array( (string) $cat_obj-&gt;term_id, $category, true ) ) {
			return true;
		} elseif ( in_array( $cat_obj-&gt;name, $category, true ) ) {
			return true;
		} elseif ( in_array( $cat_obj-&gt;slug, $category, true ) ) {
			return true;
		}

		return false;
	}

	/**
	 * Determines whether the query is for an existing tag archive page.
	 *
	 * If the $tag parameter is specified, this function will additionally
	 * check if the query is for one of the tags specified.
	 *
	 * @since 3.1.0
	 *
	 * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such
	 *                                       to check against. Default empty.
	 * @return bool Whether the query is for an existing tag archive page.
	 */
	public function is_tag( $tag = &#039;&#039; ) {
		if ( ! $this-&gt;is_tag ) {
			return false;
		}

		if ( empty( $tag ) ) {
			return true;
		}

		$tag_obj = $this-&gt;get_queried_object();
		if ( ! $tag_obj ) {
			return false;
		}

		$tag = array_map( &#039;strval&#039;, (array) $tag );

		if ( in_array( (string) $tag_obj-&gt;term_id, $tag, true ) ) {
			return true;
		} elseif ( in_array( $tag_obj-&gt;name, $tag, true ) ) {
			return true;
		} elseif ( in_array( $tag_obj-&gt;slug, $tag, true ) ) {
			return true;
		}

		return false;
	}

	/**
	 * Determines whether the query is for an existing custom taxonomy archive page.
	 *
	 * If the $taxonomy parameter is specified, this function will additionally
	 * check if the query is for that specific $taxonomy.
	 *
	 * If the $term parameter is specified in addition to the $taxonomy parameter,
	 * this function will additionally check if the query is for one of the terms
	 * specified.
	 *
	 * @since 3.1.0
	 *
	 * @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies.
	 *
	 * @param string|string[]           $taxonomy Optional. Taxonomy slug or slugs to check against.
	 *                                            Default empty.
	 * @param int|string|int[]|string[] $term     Optional. Term ID, name, slug, or array of such
	 *                                            to check against. Default empty.
	 * @return bool Whether the query is for an existing custom taxonomy archive page.
	 *              True for custom taxonomy archive pages, false for built-in taxonomies
	 *              (category and tag archives).
	 */
	public function is_tax( $taxonomy = &#039;&#039;, $term = &#039;&#039; ) {
		global $wp_taxonomies;

		if ( ! $this-&gt;is_tax ) {
			return false;
		}

		if ( empty( $taxonomy ) ) {
			return true;
		}

		$queried_object = $this-&gt;get_queried_object();
		$tax_array      = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
		$term_array     = (array) $term;

		// Check that the taxonomy matches.
		if ( ! ( isset( $queried_object-&gt;taxonomy ) &amp;&amp; count( $tax_array ) &amp;&amp; in_array( $queried_object-&gt;taxonomy, $tax_array, true ) ) ) {
			return false;
		}

		// Only a taxonomy provided.
		if ( empty( $term ) ) {
			return true;
		}

		return isset( $queried_object-&gt;term_id ) &amp;&amp;
			count(
				array_intersect(
					array( $queried_object-&gt;term_id, $queried_object-&gt;name, $queried_object-&gt;slug ),
					$term_array
				)
			);
	}

	/**
	 * Determines whether the current URL is within the comments popup window.
	 *
	 * @since 3.1.0
	 * @deprecated 4.5.0
	 *
	 * @return false Always returns false.
	 */
	public function is_comments_popup() {
		_deprecated_function( __FUNCTION__, &#039;4.5.0&#039; );

		return false;
	}

	/**
	 * Determines whether the query is for an existing date archive.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for an existing date archive.
	 */
	public function is_date() {
		return (bool) $this-&gt;is_date;
	}

	/**
	 * Determines whether the query is for an existing day archive.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for an existing day archive.
	 */
	public function is_day() {
		return (bool) $this-&gt;is_day;
	}

	/**
	 * Determines whether the query is for a feed.
	 *
	 * @since 3.1.0
	 *
	 * @param string|string[] $feeds Optional. Feed type or array of feed types
	 *                                         to check against. Default empty.
	 * @return bool Whether the query is for a feed.
	 */
	public function is_feed( $feeds = &#039;&#039; ) {
		if ( empty( $feeds ) || ! $this-&gt;is_feed ) {
			return (bool) $this-&gt;is_feed;
		}

		$query_var = $this-&gt;get( &#039;feed&#039; );
		if ( &#039;feed&#039; === $query_var ) {
			$query_var = get_default_feed();
		}

		return in_array( $query_var, (array) $feeds, true );
	}

	/**
	 * Determines whether the query is for a comments feed.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for a comments feed.
	 */
	public function is_comment_feed() {
		return (bool) $this-&gt;is_comment_feed;
	}

	/**
	 * Determines whether the query is for the front page of the site.
	 *
	 * This is for what is displayed at your site&#039;s main URL.
	 *
	 * Depends on the site&#039;s &quot;Front page displays&quot; Reading Settings &#039;show_on_front&#039; and &#039;page_on_front&#039;.
	 *
	 * If you set a static page for the front page of your site, this function will return
	 * true when viewing that page.
	 *
	 * Otherwise the same as <a href="https://developer.wordpress.org/reference/classes/WP_Query/is_home/">WP_Query::is_home()</a>.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for the front page of the site.
	 */
	public function is_front_page() {
		// Most likely case.
		if ( &#039;posts&#039; === get_option( &#039;show_on_front&#039; ) &amp;&amp; $this-&gt;is_home() ) {
			return true;
		} elseif ( &#039;page&#039; === get_option( &#039;show_on_front&#039; ) &amp;&amp; get_option( &#039;page_on_front&#039; )
			&amp;&amp; $this-&gt;is_page( get_option( &#039;page_on_front&#039; ) )
		) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * Determines whether the query is for the blog homepage.
	 *
	 * This is the page which shows the time based blog content of your site.
	 *
	 * Depends on the site&#039;s &quot;Front page displays&quot; Reading Settings &#039;show_on_front&#039; and &#039;page_for_posts&#039;.
	 *
	 * If you set a static page for the front page of your site, this function will return
	 * true only on the page you set as the &quot;Posts page&quot;.
	 *
	 * @since 3.1.0
	 *
	 * @see WP_Query::is_front_page()
	 *
	 * @return bool Whether the query is for the blog homepage.
	 */
	public function is_home() {
		return (bool) $this-&gt;is_home;
	}

	/**
	 * Determines whether the query is for the Privacy Policy page.
	 *
	 * This is the page which shows the Privacy Policy content of your site.
	 *
	 * Depends on the site&#039;s &quot;Change your Privacy Policy page&quot; Privacy Settings &#039;wp_page_for_privacy_policy&#039;.
	 *
	 * This function will return true only on the page you set as the &quot;Privacy Policy page&quot;.
	 *
	 * @since 5.2.0
	 *
	 * @return bool Whether the query is for the Privacy Policy page.
	 */
	public function is_privacy_policy() {
		if ( get_option( &#039;wp_page_for_privacy_policy&#039; )
			&amp;&amp; $this-&gt;is_page( get_option( &#039;wp_page_for_privacy_policy&#039; ) )
		) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * Determines whether the query is for an existing month archive.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for an existing month archive.
	 */
	public function is_month() {
		return (bool) $this-&gt;is_month;
	}

	/**
	 * Determines whether the query is for an existing single page.
	 *
	 * If the $page parameter is specified, this function will additionally
	 * check if the query is for one of the pages specified.
	 *
	 * @since 3.1.0
	 *
	 * @see WP_Query::is_single()
	 * @see WP_Query::is_singular()
	 *
	 * @param int|string|int[]|string[] $page Optional. Page ID, title, slug, path, or array of such
	 *                                        to check against. Default empty.
	 * @return bool Whether the query is for an existing single page.
	 */
	public function is_page( $page = &#039;&#039; ) {
		if ( ! $this-&gt;is_page ) {
			return false;
		}

		if ( empty( $page ) ) {
			return true;
		}

		$page_obj = $this-&gt;get_queried_object();
		if ( ! $page_obj ) {
			return false;
		}

		$page = array_map( &#039;strval&#039;, (array) $page );

		if ( in_array( (string) $page_obj-&gt;ID, $page, true ) ) {
			return true;
		} elseif ( in_array( $page_obj-&gt;post_title, $page, true ) ) {
			return true;
		} elseif ( in_array( $page_obj-&gt;post_name, $page, true ) ) {
			return true;
		} else {
			foreach ( $page as $pagepath ) {
				if ( ! strpos( $pagepath, &#039;/&#039; ) ) {
					continue;
				}

				$pagepath_obj = get_page_by_path( $pagepath );

				if ( $pagepath_obj &amp;&amp; ( $pagepath_obj-&gt;ID === $page_obj-&gt;ID ) ) {
					return true;
				}
			}
		}

		return false;
	}

	/**
	 * Determines whether the query is for a paged result and not for the first page.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for a paged result.
	 */
	public function is_paged() {
		return (bool) $this-&gt;is_paged;
	}

	/**
	 * Determines whether the query is for a post or page preview.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for a post or page preview.
	 */
	public function is_preview() {
		return (bool) $this-&gt;is_preview;
	}

	/**
	 * Determines whether the query is for the robots.txt file.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for the robots.txt file.
	 */
	public function is_robots() {
		return (bool) $this-&gt;is_robots;
	}

	/**
	 * Determines whether the query is for the favicon.ico file.
	 *
	 * @since 5.4.0
	 *
	 * @return bool Whether the query is for the favicon.ico file.
	 */
	public function is_favicon() {
		return (bool) $this-&gt;is_favicon;
	}

	/**
	 * Determines whether the query is for a sitemap.
	 *
	 * @since 7.1.0
	 *
	 * @return bool Whether the query is for a sitemap.
	 */
	public function is_sitemap(): bool {
		return $this-&gt;is_sitemap;
	}

	/**
	 * Determines whether the query is for a search.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for a search.
	 */
	public function is_search() {
		return (bool) $this-&gt;is_search;
	}

	/**
	 * Determines whether the query is for an existing single post.
	 *
	 * Works for any post type excluding pages.
	 *
	 * If the $post parameter is specified, this function will additionally
	 * check if the query is for one of the Posts specified.
	 *
	 * @since 3.1.0
	 *
	 * @see WP_Query::is_page()
	 * @see WP_Query::is_singular()
	 *
	 * @param int|string|int[]|string[] $post Optional. Post ID, title, slug, path, or array of such
	 *                                        to check against. Default empty.
	 * @return bool Whether the query is for an existing single post.
	 */
	public function is_single( $post = &#039;&#039; ) {
		if ( ! $this-&gt;is_single ) {
			return false;
		}

		if ( empty( $post ) ) {
			return true;
		}

		$post_obj = $this-&gt;get_queried_object();
		if ( ! $post_obj ) {
			return false;
		}

		$post = array_map( &#039;strval&#039;, (array) $post );

		if ( in_array( (string) $post_obj-&gt;ID, $post, true ) ) {
			return true;
		} elseif ( in_array( $post_obj-&gt;post_title, $post, true ) ) {
			return true;
		} elseif ( in_array( $post_obj-&gt;post_name, $post, true ) ) {
			return true;
		} else {
			foreach ( $post as $postpath ) {
				if ( ! strpos( $postpath, &#039;/&#039; ) ) {
					continue;
				}

				$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj-&gt;post_type );

				if ( $postpath_obj &amp;&amp; ( $postpath_obj-&gt;ID === $post_obj-&gt;ID ) ) {
					return true;
				}
			}
		}
		return false;
	}

	/**
	 * Determines whether the query is for an existing single post of any post type
	 * (post, attachment, page, custom post types).
	 *
	 * If the $post_types parameter is specified, this function will additionally
	 * check if the query is for one of the Posts Types specified.
	 *
	 * @since 3.1.0
	 *
	 * @see WP_Query::is_page()
	 * @see WP_Query::is_single()
	 *
	 * @param string|string[] $post_types Optional. Post type or array of post types
	 *                                    to check against. Default empty.
	 * @return bool Whether the query is for an existing single post
	 *              or any of the given post types.
	 */
	public function is_singular( $post_types = &#039;&#039; ) {
		if ( empty( $post_types ) || ! $this-&gt;is_singular ) {
			return (bool) $this-&gt;is_singular;
		}

		$post_obj = $this-&gt;get_queried_object();
		if ( ! $post_obj ) {
			return false;
		}

		return in_array( $post_obj-&gt;post_type, (array) $post_types, true );
	}

	/**
	 * Determines whether the query is for a specific time.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for a specific time.
	 */
	public function is_time() {
		return (bool) $this-&gt;is_time;
	}

	/**
	 * Determines whether the query is for a trackback endpoint call.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for a trackback endpoint call.
	 */
	public function is_trackback() {
		return (bool) $this-&gt;is_trackback;
	}

	/**
	 * Determines whether the query is for an existing year archive.
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is for an existing year archive.
	 */
	public function is_year() {
		return (bool) $this-&gt;is_year;
	}

	/**
	 * Determines whether the query is a 404 (returns no results).
	 *
	 * @since 3.1.0
	 *
	 * @return bool Whether the query is a 404 error.
	 */
	public function is_404() {
		return (bool) $this-&gt;is_404;
	}

	/**
	 * Determines whether the query is for an embedded post.
	 *
	 * @since 4.4.0
	 *
	 * @return bool Whether the query is for an embedded post.
	 */
	public function is_embed() {
		return (bool) $this-&gt;is_embed;
	}

	/**
	 * Determines whether the query is the main query.
	 *
	 * @since 3.3.0
	 *
	 * @global WP_Query $wp_the_query WordPress Query object.
	 *
	 * @return bool Whether the query is the main query.
	 */
	public function is_main_query() {
		global $wp_the_query;
		return $wp_the_query === $this;
	}

	/**
	 * Sets up global post data.
	 *
	 * @since 4.1.0
	 * @since 4.4.0 Added the ability to pass a post ID to `$post`.
	 *
	 * @global int     $id
	 * @global WP_User $authordata
	 * @global string  $currentday
	 * @global string  $currentmonth
	 * @global int     $page
	 * @global array   $pages
	 * @global int     $multipage
	 * @global int     $more
	 * @global int     $numpages
	 *
	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
	 * @return bool True on success, false on failure.
	 */
	public function setup_postdata( $post ) {
		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;

		if ( ! ( $post instanceof WP_Post ) ) {
			$post = get_post( $post );
		}

		if ( ! $post ) {
			return false;
		}

		$elements = $this-&gt;generate_postdata( $post );
		if ( false === $elements ) {
			return false;
		}

		$id           = $elements[&#039;id&#039;];
		$authordata   = $elements[&#039;authordata&#039;];
		$currentday   = $elements[&#039;currentday&#039;];
		$currentmonth = $elements[&#039;currentmonth&#039;];
		$page         = $elements[&#039;page&#039;];
		$pages        = $elements[&#039;pages&#039;];
		$multipage    = $elements[&#039;multipage&#039;];
		$more         = $elements[&#039;more&#039;];
		$numpages     = $elements[&#039;numpages&#039;];

		/**
		 * Fires once the post data has been set up.
		 *
		 * @since 2.8.0
		 * @since 4.1.0 Introduced `$query` parameter.
		 *
		 * @param WP_Post  $post  The Post object (passed by reference).
		 * @param WP_Query $query The current Query object (passed by reference).
		 */
		do_action_ref_array( &#039;the_post&#039;, array( &amp;$post, &amp;$this ) );

		return true;
	}

	/**
	 * Generates post data.
	 *
	 * @since 5.2.0
	 *
	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
	 * @return array|false Elements of post or false on failure.
	 */
	public function generate_postdata( $post ) {

		if ( ! ( $post instanceof WP_Post ) ) {
			$post = get_post( $post );
		}

		if ( ! $post ) {
			return false;
		}

		$id = (int) $post-&gt;ID;

		$authordata = get_userdata( $post-&gt;post_author );

		$currentday   = false;
		$currentmonth = false;

		$post_date = $post-&gt;post_date;
		if ( ! empty( $post_date ) &amp;&amp; &#039;0000-00-00 00:00:00&#039; !== $post_date ) {
			// Avoid using mysql2date for performance reasons.
			$currentmonth = substr( $post_date, 5, 2 );
			$day          = substr( $post_date, 8, 2 );
			$year         = substr( $post_date, 2, 2 );

			$currentday = sprintf( &#039;%s.%s.%s&#039;, $day, $currentmonth, $year );
		}

		$numpages  = 1;
		$multipage = 0;
		$page      = $this-&gt;get( &#039;page&#039; );
		if ( ! $page ) {
			$page = 1;
		}

		/*
		 * Force full post content when viewing the permalink for the $post,
		 * or when on an RSS feed. Otherwise respect the &#039;more&#039; tag.
		 */
		if ( get_queried_object_id() === $post-&gt;ID &amp;&amp; ( $this-&gt;is_page() || $this-&gt;is_single() ) ) {
			$more = 1;
		} elseif ( $this-&gt;is_feed() ) {
			$more = 1;
		} else {
			$more = 0;
		}

		$content = $post-&gt;post_content;
		if ( str_contains( $content, &#039;&lt;!--nextpage--&gt;&#039; ) ) {
			$content = str_replace( &quot;\n&lt;!--nextpage--&gt;\n&quot;, &#039;&lt;!--nextpage--&gt;&#039;, $content );
			$content = str_replace( &quot;\n&lt;!--nextpage--&gt;&quot;, &#039;&lt;!--nextpage--&gt;&#039;, $content );
			$content = str_replace( &quot;&lt;!--nextpage--&gt;\n&quot;, &#039;&lt;!--nextpage--&gt;&#039;, $content );

			// Remove the nextpage block delimiters, to avoid invalid block structures in the split content.
			$content = str_replace( &#039;&lt;!-- wp:nextpage --&gt;&#039;, &#039;&#039;, $content );
			$content = str_replace( &#039;&lt;!-- /wp:nextpage --&gt;&#039;, &#039;&#039;, $content );

			// Ignore nextpage at the beginning of the content.
			if ( str_starts_with( $content, &#039;&lt;!--nextpage--&gt;&#039; ) ) {
				$content = substr( $content, 15 );
			}

			$pages = explode( &#039;&lt;!--nextpage--&gt;&#039;, $content );
		} else {
			$pages = array( $post-&gt;post_content );
		}

		/**
		 * Filters the &quot;pages&quot; derived from splitting the post content.
		 *
		 * &quot;Pages&quot; are determined by splitting the post content based on the presence
		 * of `&lt;!-- nextpage --&gt;` tags.
		 *
		 * @since 4.4.0
		 *
		 * @param string[] $pages Array of &quot;pages&quot; from the post content split by `&lt;!-- nextpage --&gt;` tags.
		 * @param WP_Post  $post  Current post object.
		 */
		$pages = apply_filters( &#039;content_pagination&#039;, $pages, $post );

		$numpages = count( $pages );

		if ( $numpages &gt; 1 ) {
			if ( $page &gt; 1 ) {
				$more = 1;
			}
			$multipage = 1;
		} else {
			$multipage = 0;
		}

		$elements = compact( &#039;id&#039;, &#039;authordata&#039;, &#039;currentday&#039;, &#039;currentmonth&#039;, &#039;page&#039;, &#039;pages&#039;, &#039;multipage&#039;, &#039;more&#039;, &#039;numpages&#039; );

		return $elements;
	}

	/**
	 * Generates cache key.
	 *
	 * @since 6.1.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param array  $args Query arguments.
	 * @param string $sql  SQL statement.
	 * @return string Cache key.
	 */
	protected function generate_cache_key( array $args, $sql ) {
		global $wpdb;

		unset(
			$args[&#039;cache_results&#039;],
			$args[&#039;fields&#039;],
			$args[&#039;lazy_load_term_meta&#039;],
			$args[&#039;update_post_meta_cache&#039;],
			$args[&#039;update_post_term_cache&#039;],
			$args[&#039;update_menu_item_cache&#039;],
			$args[&#039;suppress_filters&#039;]
		);

		if ( empty( $args[&#039;post_type&#039;] ) ) {
			if ( $this-&gt;is_attachment ) {
				$args[&#039;post_type&#039;] = &#039;attachment&#039;;
			} elseif ( $this-&gt;is_page ) {
				$args[&#039;post_type&#039;] = &#039;page&#039;;
			} else {
				$args[&#039;post_type&#039;] = &#039;post&#039;;
			}
		} elseif ( &#039;any&#039; === $args[&#039;post_type&#039;] ) {
			$args[&#039;post_type&#039;] = array_values( get_post_types( array( &#039;exclude_from_search&#039; =&gt; false ) ) );
		}
		$args[&#039;post_type&#039;] = (array) $args[&#039;post_type&#039;];
		// Sort post types to ensure same cache key generation.
		sort( $args[&#039;post_type&#039;] );

		/*
		 * Sort arrays that can be used for ordering prior to cache key generation.
		 *
		 * These arrays are sorted in the query generator for the purposes of the
		 * WHERE clause but the arguments are not modified as they can be used for
		 * the orderby clause.
		 *
		 * Their use in the orderby clause will generate a different SQL query so
		 * they can be sorted for the cache key generation.
		 */
		$sortable_arrays_with_int_values = array(
			&#039;post__in&#039;,
			&#039;post_parent__in&#039;,
		);
		foreach ( $sortable_arrays_with_int_values as $key ) {
			if ( isset( $args[ $key ] ) &amp;&amp; is_array( $args[ $key ] ) ) {
				$args[ $key ] = array_unique( array_map( &#039;absint&#039;, $args[ $key ] ) );
				sort( $args[ $key ] );
			}
		}

		// Sort and unique the &#039;post_name__in&#039; for cache key generation.
		if ( isset( $args[&#039;post_name__in&#039;] ) &amp;&amp; is_array( $args[&#039;post_name__in&#039;] ) ) {
			$args[&#039;post_name__in&#039;] = array_unique( $args[&#039;post_name__in&#039;] );
			sort( $args[&#039;post_name__in&#039;] );
		}

		if ( isset( $args[&#039;post_status&#039;] ) ) {
			$args[&#039;post_status&#039;] = (array) $args[&#039;post_status&#039;];
			// Sort post status to ensure same cache key generation.
			sort( $args[&#039;post_status&#039;] );
		}

		// Add a default orderby value of date to ensure same cache key generation.
		if ( ! isset( $args[&#039;orderby&#039;] ) ) {
			$args[&#039;orderby&#039;] = &#039;date&#039;;
		}

		$placeholder = $wpdb-&gt;placeholder_escape();
		array_walk_recursive(
			$args,
			/*
			 * Replace wpdb placeholders with the string used in the database
			 * query to avoid unreachable cache keys. This is necessary because
			 * the placeholder is randomly generated in each request.
			 *
			 * $value is passed by reference to allow it to be modified.
			 * array_walk_recursive() does not return an array.
			 */
			static function ( &amp;$value ) use ( $wpdb, $placeholder ) {
				if ( is_string( $value ) &amp;&amp; str_contains( $value, $placeholder ) ) {
					$value = $wpdb-&gt;remove_placeholder_escape( $value );
				}
			}
		);

		ksort( $args );

		// Replace wpdb placeholder in the SQL statement used by the cache key.
		$sql = $wpdb-&gt;remove_placeholder_escape( $sql );
		$key = md5( serialize( $args ) . $sql );

		$this-&gt;query_cache_key = &quot;wp_query:$key&quot;;
		return $this-&gt;query_cache_key;
	}

	/**
	 * After looping through a nested query, this function
	 * restores the $post global to the current post in this query.
	 *
	 * @since 3.7.0
	 *
	 * @global WP_Post $post Global post object.
	 */
	public function reset_postdata() {
		if ( ! empty( $this-&gt;post ) ) {
			$GLOBALS[&#039;post&#039;] = $this-&gt;post;
			$this-&gt;setup_postdata( $this-&gt;post );
		}
	}

	/**
	 * Lazyloads term meta for posts in the loop.
	 *
	 * @since 4.4.0
	 * @deprecated 4.5.0 See wp_queue_posts_for_term_meta_lazyload().
	 *
	 * @param mixed $check
	 * @param int   $term_id
	 * @return mixed
	 */
	public function lazyload_term_meta( $check, $term_id ) {
		_deprecated_function( __METHOD__, &#039;4.5.0&#039; );
		return $check;
	}

	/**
	 * Lazyloads comment meta for comments in the loop.
	 *
	 * @since 4.4.0
	 * @deprecated 4.5.0 See wp_lazyload_comment_meta().
	 *
	 * @param mixed $check
	 * @param int   $comment_id
	 * @return mixed
	 */
	public function lazyload_comment_meta( $check, $comment_id ) {
		_deprecated_function( __METHOD__, &#039;4.5.0&#039; );
		return $check;
	}
}
</code></pre><p class="wporg-dot-link-list"><a href="https://developer.wordpress.org/reference/files/wp-includes/class-wp-query.php/">View all references</a> <a href="https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-query.php#L18">View on Trac</a> <a href="https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-query.php#L18-L5148">View on GitHub</a></p></section>
		
		
		<section class="wp-block-wporg-code-reference-changelog"><h2 id="changelog" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#changelog">Changelog</a></h2> <section style="margin-top:var(--wp--preset--spacing--20)" class="wp-block-wporg-code-table"><figure class="wp-block-table "><table><thead><tr><th scope="col">Version</th><th scope="col">Description</th></tr></thead><tbody><tr class=""><td><a href="https://developer.wordpress.org/reference/since/4.5.0/">4.5.0</a></td><td><span class="since-description">Removed the <code>$comments_popup</code> property.</span></td></tr><tr class=""><td><a href="https://developer.wordpress.org/reference/since/1.5.0/">1.5.0</a></td><td>Introduced.</td></tr></tbody></table></figure></section> </section>
		<section class="wp-block-wporg-code-reference-comments" data-nosnippet="true"><h2 id="user-contributed-notes" class="is-toc-heading wp-block-heading" tabindex="-1" ><a href="#user-contributed-notes">User Contributed Notes</a></h2> <ol class="comment-list">			<li id="comment-5502" data-comment-id="5502" class="comment byuser comment-author-sayedulsayem even thread-even depth-1">
			<article id="div-comment-5502" class="comment-body">

							<a href="#comment-content-5502" class="screen-reader-text">Skip to note 33 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/sayedulsayem/" rel="external nofollow">Sayedul Sayem</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5502">
							<time datetime="2021-11-24T19:28:29+00:00">
							5 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="077448249b" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5502" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5502"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="96% like this"><span class="screen-reader-text">Vote results for this note: </span>24</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5502" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5502"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5502">
				<p>For lazy developers like me. :D<br />
You don&#8217;t need to read the full article. I already covered the most common scenario.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">&lt;?php
// WP_Query arguments
$args = array(
    'post_type'              =&gt; array('post'), // use any for any kind of post type, custom post type slug for custom post type
    'post_status'            =&gt; array('publish'), // Also support: pending, draft, auto-draft, future, private, inherit, trash, any
    'posts_per_page'         =&gt; '5', // use -1 for all post
    'order'                  =&gt; 'DESC', // Also support: ASC
    'orderby'                =&gt; 'date', // Also support: none, rand, id, title, slug, modified, parent, menu_order, comment_count
    'tax_query'              =&gt; array(
        'relation' =&gt; 'OR', // Use AND for taking result on both condition true
        array(
            'taxonomy'         =&gt; 'category', // taxonomy slug
            'terms'            =&gt; array(1, 2), // term ids
            'field'            =&gt; 'term_id', // Also support: slug, name, term_taxonomy_id
            'operator'         =&gt; 'IN', // Also support: AND, NOT IN, EXISTS, NOT EXISTS
            'include_children' =&gt; true,
        ),
        array(
            'taxonomy'         =&gt; 'custom-category', // taxonomy slug
            'terms'            =&gt; array(1, 2), // term ids
            'field'            =&gt; 'term_id', // Also support: slug, name, term_taxonomy_id
            'operator'         =&gt; 'IN', // Also support: slug, name, term_taxonomy_id
            'include_children' =&gt; true,
        ),
    ),
    'meta_query'             =&gt; array(
        'relation' =&gt; 'OR', // Use AND for taking result on both condition true
        array(
            'key'     =&gt; 'meta-1', // any meta key
            'value'   =&gt; 'value-1', // value under that meta
            'compare' =&gt; 'LIKE', // Also support: =, !=, &gt;, &gt;=, &lt;, &lt;=, NOT LIKE, IN, NOT IN, BETWEEN, NOT BETWEEN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE
            'type'    =&gt; 'CHAR', // Also support: NUMERIC, BINARY, DATE, DATETIME, DECIMAL, SIGNED, UNSIGNED, TIME
        ),
        array(
            'key'     =&gt; 'meta-2', // any meta key
            'value'   =&gt; 'value-2', // value under that meta
            'compare' =&gt; 'LIKE', // Also support: =, !=, &gt;, &gt;=, &lt;, &lt;=, NOT LIKE, IN, NOT IN, BETWEEN, NOT BETWEEN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE
            'type'    =&gt; 'CHAR', // Also support: NUMERIC, BINARY, DATE, DATETIME, DECIMAL, SIGNED, UNSIGNED, TIME
        ),
    ),
);

// The Query
$query = new WP_Query($args);

// The Loop
if ($query-&gt;have_posts()) {
    while ($query-&gt;have_posts()) {
        $query-&gt;the_post();
        // do something
    }
} else {
    // no posts found
}

// Restore original Post Data
wp_reset_postdata();</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-5502' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5502%23feedback-editor-5502" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-2378" data-comment-id="2378" class="comment byuser comment-author-jdgrimes odd alt thread-odd thread-alt depth-1">
			<article id="div-comment-2378" class="comment-body">

							<a href="#comment-content-2378" class="screen-reader-text">Skip to note 34 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/jdgrimes/" rel="external nofollow">J.D. Grimes</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-2378">
							<time datetime="2017-09-22T00:24:13+00:00">
							9 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="28b68a9aac" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="2378" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2378"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>23</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="2378" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2378"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-2378">
				<p>Beware of setting the <code>'post_status'</code> to anything other than <code>'public'</code>, as it can easily lead to an <strong>information disclosure vulnerability</strong> if you are not careful.</p>
<p>Normally <code>WP_Query</code> applies logic that will ensure that it only returns posts that the current user should be able to view (e.g., <code>private</code> posts are excluded from low-privilege users). However, when you supply a value for <code>'post_status'</code> this capability-checking logic is effectively disabled. This means that if you pass <code>'post_status'</code> as <code>'private'</code>, private posts will be returned even if the current user is not even logged in.</p>
<p>To ensure that the proper capability checks are applied, you must use <a href="https://developer.wordpress.org/reference/classes/WP_Query/#permission-parameters">the <code>'perm'</code> arg</a> as well. It has two possible values: <code>'readable'</code> and <code>'editable'</code>. Passing this will ensure that only posts are returned that the user is allowed to read or edit, respectively.</p>
<p>In summary, <strong>always set <code>'perm' =&gt; 'readable'</code> when passing the <code>'post_status'</code> arg, if you are going to be exposing the query results to the user in any way</strong>. And if the posts are going to be modified, pass <code>'perm' =&gt; 'editable'</code>.</p>
				</div><!-- .comment-content -->

					<section id='feedback-2378' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D2378%23feedback-editor-2378" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-1713" data-comment-id="1713" class="comment byuser comment-author-ramiy even thread-even depth-1">
			<article id="div-comment-1713" class="comment-body">

							<a href="#comment-content-1713" class="screen-reader-text">Skip to note 35 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/ramiy/" rel="external nofollow">Rami Yushuvaev</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-1713">
							<time datetime="2016-07-17T00:31:33+00:00">
							10 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="5c406343aa" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="1713" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-1713"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="79% like this"><span class="screen-reader-text">Vote results for this note: </span>8</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="1713" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-1713"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-1713">
				<p>WordPress <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a> Generator:</p>
<p><a href="https://GenerateWP.com/wp_query/" rel="nofollow ugc">https://GenerateWP.com/wp_query/</a></p>
				</div><!-- .comment-content -->

					<section id='feedback-1713' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D1713%23feedback-editor-1713" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-4747" data-comment-id="4747" class="comment byuser comment-author-nyxko odd alt thread-odd thread-alt depth-1">
			<article id="div-comment-4747" class="comment-body">

							<a href="#comment-content-4747" class="screen-reader-text">Skip to note 36 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/nyxko/" rel="external nofollow">Nicolae Pop</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-4747">
							<time datetime="2021-01-12T14:50:40+00:00">
							6 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="743d4ed78f" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="4747" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-4747"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="89% like this"><span class="screen-reader-text">Vote results for this note: </span>7</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="4747" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-4747"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-4747">
				<p>When you need to query for posts that have a featured image (post thumbnail) set, you can use the meta_query parameter like this:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
    'meta_query' =&gt; array(
        array(
         'key' =&gt; '_thumbnail_id',
         'compare' =&gt; 'EXISTS'
        ),
    ),
);</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-4747' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D4747%23feedback-editor-4747" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5834" data-comment-id="5834" class="comment byuser comment-author-lovor even thread-even depth-1">
			<article id="div-comment-5834" class="comment-body">

							<a href="#comment-content-5834" class="screen-reader-text">Skip to note 37 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/lovor/" rel="external nofollow">Lovro Hrust</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5834">
							<time datetime="2022-05-23T11:29:13+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="6591f1e67b" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5834" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5834"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>3</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5834" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5834"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5834">
				<p>When you need to retreive only last n posts, without pagination, it is useful to use undocumented (it is documented only on code) parameter &#8216;no_found_rows&#8217; =&gt; true. This will increase performance.</p>
				</div><!-- .comment-content -->

					<section id='feedback-5834' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5834%23feedback-editor-5834" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-2218" data-comment-id="2218" class="comment byuser comment-author-howdy_mcgee odd alt thread-odd thread-alt depth-1">
			<article id="div-comment-2218" class="comment-body">

							<a href="#comment-content-2218" class="screen-reader-text">Skip to note 38 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/howdy_mcgee/" rel="external nofollow">Howdy_McGee</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-2218">
							<time datetime="2017-05-08T20:58:59+00:00">
							9 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="c83bcede23" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="2218" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2218"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="75% like this"><span class="screen-reader-text">Vote results for this note: </span>2</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="2218" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2218"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-2218">
				<p>When using the `fields` parameter passed to <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a>, the Object Cache parameters will be set to `false` by WP_Query:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">array(
	...
	'fields' =&gt; 'ids',
	'cache_results' =&gt; false,			// Turned off by default since 'fields' was passed.
	'update_post_meta_cache' =&gt; false, 	// Turned off by default since 'fields' was passed.
	'update_post_term_cache' =&gt; false,	// Turned off by default since 'fields' was passed.
	...
);</code></pre>
<p>The reason being there&#8217;s no objects being returned and thus no objects to cache.</p>
				</div><!-- .comment-content -->

					<section id='feedback-2218' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D2218%23feedback-editor-2218" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-2510" data-comment-id="2510" class="comment byuser comment-author-_smartik_ even thread-even depth-1">
			<article id="div-comment-2510" class="comment-body">

							<a href="#comment-content-2510" class="screen-reader-text">Skip to note 39 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/_smartik_/" rel="external nofollow">Andrei Surdu</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-2510">
							<time datetime="2017-12-26T14:27:31+00:00">
							9 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="b958ead159" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="2510" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2510"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="67% like this"><span class="screen-reader-text">Vote results for this note: </span>2</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="2510" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2510"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-2510">
				<p>The documentation states that `<code>tax</code>` parameter is deprecated since 3.1(not working anymore) in favor of `<code>tax_query</code>`, but it does not explain how to use `<code>tax_query</code>` to get all posts that belongs to a taxonomy, regardless of `<code>terms</code>` value.</p>
<p>Long story, short. If you want to get all posts from a specific taxonomy, set the `<code>operator</code>` to `<code>EXISTS</code>`.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
    'post_type' =&gt; 'post',
    'post_status' =&gt; 'publish',
    'tax_query' =&gt; array(
        array(
            'taxonomy' =&gt; 'custom_taxonomy_slug',
            'operator' =&gt; 'EXISTS'
        ),
    ),
);</code></pre>
<p><em>Note: make sure to set the <code>post_type</code> value and replace the <code>custom_taxonomy_slug</code> string, if you copy/paste this snippet.</em></p>
				</div><!-- .comment-content -->

					<section id='feedback-2510' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D2510%23feedback-editor-2510" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-3377" data-comment-id="3377" class="comment byuser comment-author-spyrosvl odd alt thread-odd thread-alt depth-1">
			<article id="div-comment-3377" class="comment-body">

							<a href="#comment-content-3377" class="screen-reader-text">Skip to note 40 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/spyrosvl/" rel="external nofollow">Nitroweb</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-3377">
							<time datetime="2019-09-11T16:59:43+00:00">
							7 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="bc4116d730" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="3377" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3377"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>2</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="3377" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3377"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-3377">
				<p>Make sure that when you are setting a <code>meta_query type</code> to <code>DECIMAL</code>, that you have also set the precision and the scale, for example in your query array </p>
<pre class="wp-block-code"><code lang="php" class="language-php ">'compare' =&gt; '&gt;=',
'type' =&gt; 'DECIMAL(5,2)',</code></pre>
<p>For more info check the MySQL manual <a href="https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html" rel="nofollow ugc">https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html</a></p>
				</div><!-- .comment-content -->

					<section id='feedback-3377' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D3377%23feedback-editor-3377" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-3451" data-comment-id="3451" class="comment byuser comment-author-yansern even thread-even depth-1">
			<article id="div-comment-3451" class="comment-body">

							<a href="#comment-content-3451" class="screen-reader-text">Skip to note 41 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/yansern/" rel="external nofollow">Yan Sern</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-3451">
							<time datetime="2019-11-04T13:08:41+00:00">
							7 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="fa6866ee17" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="3451" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3451"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="75% like this"><span class="screen-reader-text">Vote results for this note: </span>2</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="3451" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3451"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-3451">
				<p>If for some reason you&#8217;re storing comma separated values and you would like to find out if there is a match, you can use this regular expression.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">&#091;
  'key'     =&gt; 'item_ids',
  'value'   =&gt; '(:?^|,)(' . $item_id. ')(:?$|,)',
  'compare' =&gt; 'REGEXP',
&#093;</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-3451' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D3451%23feedback-editor-3451" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5309" data-comment-id="5309" class="comment byuser comment-author-meisterlen odd alt thread-odd thread-alt depth-1">
			<article id="div-comment-5309" class="comment-body">

							<a href="#comment-content-5309" class="screen-reader-text">Skip to note 42 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/meisterlen/" rel="external nofollow">meisterlen</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5309">
							<time datetime="2021-09-09T12:51:35+00:00">
							5 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="076444be80" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5309" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5309"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>2</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5309" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5309"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5309">
				<p>Order Events by <code>start</code> date</p>
<p>For date format <code>yyyy-mm-dd hh:mm:ss</code></p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">       
$args = array(
    'post_type'      =&gt; 'event',
    'post_status'    =&gt; 'publish',
    'meta_key'       =&gt; 'start',
    'meta_type'      =&gt; 'DATETIME',
    'orderby'        =&gt; 'meta_value',
    'order'          =&gt; 'ASC',
);</code></pre>
<p>In this case <code>orderby</code> does not require <code>meta_value_datetime</code>.</p>
				</div><!-- .comment-content -->

					<section id='feedback-5309' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='1'>
<ul class='children'>
			<li id="comment-5535" data-comment-id="5535" class="comment byuser comment-author-lupusyon even depth-2">
			<article id="div-comment-5535" class="comment-body">

			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5535">
				<div>I thank you so much because I was getting crazy trying to order results by a datetime picker by ACF Pro. I was using this   <code> 'orderby' =&gt; 'meta_value_datetime' </code>  and it would just ignore it and sort by post date instead. I changed it to meta_value and now it works correctly.  My question is: WHY is that so?! ACF Pro stores datetime metas as &#8220;Y-m-d H:i&#8221; (i.e., for example, &#8220;2021-12-11 12:53:00&#8221;) so shouldn&#8217;t &#8220;meta_value_datetime&#8221; be the correct way? I just don&#8217;t understand.</div>
<div><a href="https://profiles.wordpress.org/lupusyon/" rel="external nofollow" class="url">lupusyon</a> <a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5535"><time datetime="2021-12-11T11:54:55+00:00">5 years ago</time></a></div>
				</div><!-- .comment-content -->

						</article>
			</li>
					</ul>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5309%23feedback-editor-5309" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-2809" data-comment-id="2809" class="comment byuser comment-author-enchiridion odd alt thread-even depth-1">
			<article id="div-comment-2809" class="comment-body">

							<a href="#comment-content-2809" class="screen-reader-text">Skip to note 43 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/enchiridion/" rel="external nofollow">Shannon Little</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-2809">
							<time datetime="2018-08-01T21:11:10+00:00">
							8 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="1b353bd0ed" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="2809" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2809"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="2809" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2809"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-2809">
				<p>If <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a> determines that the result will be singular (<code>is_singular()</code> is true), it will ignore the <code>tax_query</code> parameter. To modify <code>tax_query</code>, use the <code>posts_clauses</code> filter to add the required SQL statements.</p>
				</div><!-- .comment-content -->

					<section id='feedback-2809' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D2809%23feedback-editor-2809" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-3171" data-comment-id="3171" class="comment byuser comment-author-jtwee even thread-odd thread-alt depth-1">
			<article id="div-comment-3171" class="comment-body">

							<a href="#comment-content-3171" class="screen-reader-text">Skip to note 44 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/jtwee/" rel="external nofollow">jtwee</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-3171">
							<time datetime="2019-04-29T17:46:25+00:00">
							7 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="191ebd2888" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="3171" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3171"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="3171" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3171"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-3171">
				<p>To clarify the order and orderby parameters, <code>orderby</code> definitely accepts either a string or array (with examples shown) but <code>order</code> only accepts strings. Internally, the only values accepted are &#8216;ASC&#8217; and &#8216;DESC&#8217; with all other inputs being cast to &#8216;DESC&#8217; by default.</p>
<p>To have multiple <code>order</code> values, use the array form of <code>orderby</code> and do not include an <code>order</code> parameter.</p>
				</div><!-- .comment-content -->

					<section id='feedback-3171' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D3171%23feedback-editor-3171" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5025" data-comment-id="5025" class="comment byuser comment-author-wkeithgardner odd alt thread-even depth-1">
			<article id="div-comment-5025" class="comment-body">

							<a href="#comment-content-5025" class="screen-reader-text">Skip to note 45 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/wkeithgardner/" rel="external nofollow">keith</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5025">
							<time datetime="2021-05-04T05:57:08+00:00">
							5 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="8359f8f246" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5025" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5025"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5025" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5025"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5025">
				<p><a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a> is limited to 5 meta query clauses</p>
				</div><!-- .comment-content -->

					<section id='feedback-5025' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5025%23feedback-editor-5025" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5837" data-comment-id="5837" class="comment byuser comment-author-cristiansimion even thread-odd thread-alt depth-1">
			<article id="div-comment-5837" class="comment-body">

							<a href="#comment-content-5837" class="screen-reader-text">Skip to note 46 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/cristiansimion/" rel="external nofollow">Derains</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5837">
							<time datetime="2022-05-24T17:26:37+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="aa42f72141" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5837" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5837"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5837" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5837"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5837">
				<p>For post_types documentation, please highlight the default as being &#8216;post&#8217; if not set and highlight &#8216;any&#8217; as the parameter that needs to be passed to retrieve ids for all post types.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">// Example of the issue and how to fix. Add 'any' to post_type if you have post ids from different post types
$args = array(
    'post_type'  =&gt; 'any', // if any ids that are passed in post__in are not in post_type `post` it will be diregarded.
    'post__in'   =&gt; array( 1, 4, 200 )
);
 
$query = new WP_Query( $args );</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-5837' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5837%23feedback-editor-5837" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5873" data-comment-id="5873" class="comment byuser comment-author-nabeelperwaiz odd alt thread-even depth-1">
			<article id="div-comment-5873" class="comment-body">

							<a href="#comment-content-5873" class="screen-reader-text">Skip to note 47 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/nabeelperwaiz/" rel="external nofollow">nabeelperwaiz</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5873">
							<time datetime="2022-06-20T03:57:18+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="e9e8bc2618" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5873" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5873"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5873" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5873"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5873">
				<p>I found an issue with the <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a>, In paginated query the post displayed in first page repeats in the second page as well if any of the product from 1st page was skipped based on our conditions for the query. It happens because like if we need 16 products per page and for first page one product(e.g out of stock) was skipped. So, for 1st page it takes 17th product to complete our 16 products list. That&#8217;s expected. But now for 2nd page it don&#8217;t consider product which it had skipped for the 1st page and returns us 16 products including the 17th product again in the 2nd page results.</p>
<p>I have tackled this issue, by avoiding pagination and getting specific number of posts from filtered array of ids(unseen products). Like below code.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$last_seen       = array_search( get_option( 'ubp_last_seen', 0 ), $all_prod );
			$unseen_products = array_slice( $all_prod, $last_seen + 1 );

			$arg = array(
				'post_type'      =&gt; array( 'product', 'product_variation' ),
				'post__in'       =&gt; $unseen_products,
				'orderby'        =&gt; 'post__in',
				'posts_per_page' =&gt; $show_prod,
				// 'paged'          =&gt; $paged,
				'tax_query'      =&gt; array(
					'relation' =&gt; 'OR',
					array(
						'taxonomy' =&gt; 'product_type',
						'field'    =&gt; 'slug',
						'terms'    =&gt; array( 'simple', 'product_variation' ),
						'operator' =&gt; 'IN',
					),
					array(
						'taxonomy' =&gt; 'product_type',
						'operator' =&gt; 'NOT EXISTS',
					),
				),
			);
			if ( $product_hide_out_of_stock == 'yes' ) {
				$arg&#091;'meta_query'&#093; = array(
					array(
						'key'     =&gt; '_stock_status',
						'value'   =&gt; 'instock',
						'compare' =&gt; '=',
					),
				);
			}

			$arg      = apply_filters( 'ubp_loop_frontend_query_args', $arg );
			$products = new WP_Query( $arg );</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-5873' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5873%23feedback-editor-5873" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5979" data-comment-id="5979" class="comment byuser comment-author-huskyr even thread-odd thread-alt depth-1">
			<article id="div-comment-5979" class="comment-body">

							<a href="#comment-content-5979" class="screen-reader-text">Skip to note 48 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/huskyr/" rel="external nofollow">Hay</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5979">
							<time datetime="2022-08-15T12:36:36+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="f492b9a653" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5979" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5979"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5979" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5979"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5979">
				<p>There&#8217;s a gotcha when using the <code>orderby</code> argument in combination with a <code>meta_value</code>. Whenever you&#8217;re using a <code>meta_value</code> any posts that don&#8217;t have that specific meta value are excluded from the query. E.g. if you&#8217;re sorting by a <code>meta_key</code> called <code>color</code> posts that don&#8217;t have that value won&#8217;t be included in the query. </p>
<p>This is <a href="https://core.trac.wordpress.org/ticket/19653" rel="nofollow ugc">documented behaviour</a> and usually not a problem when creating posts with meta values from the admin interface because those values are initialised in the database (but set to an empty value). But when you&#8217;re creating posts using an automated process (perhaps using some kind of import script) this might be a problem. </p>
<p>To fix this problem there are two solutions:<br />
1. Make sure all posts have the meta value that you&#8217;re using for ordering<br />
2. Change the SQL query done by WordPress</p>
				</div><!-- .comment-content -->

					<section id='feedback-5979' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5979%23feedback-editor-5979" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6130" data-comment-id="6130" class="comment byuser comment-author-mahdiyazdani odd alt thread-even depth-1">
			<article id="div-comment-6130" class="comment-body">

							<a href="#comment-content-6130" class="screen-reader-text">Skip to note 49 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/mahdiyazdani/" rel="external nofollow">Mahdi Yazdani</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6130">
							<time datetime="2022-10-13T20:11:19+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="bb75d7e6f1" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6130" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6130"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6130" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6130"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6130">
				<p>In case your query isn’t planned to paginate results, always pass <code>no_found_rows =&gt; true</code> to <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a>.</p>
<p>Doing so will speed up your query by informing WordPress not to run <code>SQL_CALC_FOUND_ROWS</code> on the SQL query. <code>SQL_CALC_FOUND_ROWS</code> calculates the total number of rows in your query, which is required to know the total amount of “pages” for pagination.</p>
<pre class="wp-block-code"><code lang="php" class="language-php ">// Skip SQL_CALC_FOUND_ROWS for performance (no pagination).
$posts = new WP_Query( array(
  'no_found_rows' =&gt; true,
) );</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6130' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6130%23feedback-editor-6130" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6142" data-comment-id="6142" class="comment byuser comment-author-filatovdanyl even thread-odd thread-alt depth-1">
			<article id="div-comment-6142" class="comment-body">

							<a href="#comment-content-6142" class="screen-reader-text">Skip to note 50 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/filatovdanyl/" rel="external nofollow">filatovdanyl</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6142">
							<time datetime="2022-10-20T14:31:35+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="1a3046e844" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6142" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6142"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6142" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6142"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6142">
				<p>One undocumented note about <code>'operator'</code> in <code>'tax_query'</code>: if you set it to <code>'AND'</code> and pass a multiple term ids to <code>'terms'</code> &#8211; that will only work for same hierarchy level terms (it seems). If you pass it a valid subcategory id and a parent category id combination it will return empty, but if you split that into multiple tax_query arrays, and use <code>'relation' =&gt; 'AND'</code> instead it&#8217;ll work.</p>
<p>For example for this setup:<br />
<code>cat 1<br />
- subcat 2<br />
cat 3<br />
- subcat 4</code></p>
<p>This will work:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">'tax_query' =&gt; array(
    array(
        'terms'    =&gt; array( 2, 4 ),
        'operator' =&gt; 'AND',
    )
)</code></pre>
<p>And this:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">'tax_query' =&gt; array(
    'relationship' =&gt; 'AND',
    array(
        'terms' =&gt; 1,
    ),
    array(
        'terms' =&gt; 4,
    )
)</code></pre>
<p>This will not work:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">'tax_query' =&gt; array(
    array(
        'terms'    =&gt; array( 1, 4 ),
        'operator' =&gt; 'AND',
    )
)</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6142' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6142%23feedback-editor-6142" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6793" data-comment-id="6793" class="comment byuser comment-author-gregstorkan odd alt thread-even depth-1">
			<article id="div-comment-6793" class="comment-body">

							<a href="#comment-content-6793" class="screen-reader-text">Skip to note 51 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/gregstorkan/" rel="external nofollow">gregstorkan</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6793">
							<time datetime="2023-11-28T22:22:05+00:00">
							3 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="633adcdf59" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6793" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6793"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6793" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6793"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6793">
				<p><code>tax_query</code> will not work in a multisite context when using <code>switch_to_blog()</code> unless the taxonomy is registered on <strong>both blogs.</strong> The taxonomy does not need to be used or even applied to a valid post type on the current blog, but it must at least be registered. See: <a href="https://core.trac.wordpress.org/ticket/32526" rel="nofollow ugc">https://core.trac.wordpress.org/ticket/32526</a></p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">switch_to_blog( 1 ); // Switch to main site from a subsite.

$posts = get_posts(
	array(
		'post_type'        =&gt; 'post',
		'posts_per_page'   =&gt; 10,
		'post_status'      =&gt; 'publish',
		'tax_query'        =&gt; array(
			array(
				'taxonomy' =&gt; 'my_taxonomy', // Must be registered on BOTH sites.
				'field'    =&gt; 'slug',
				'terms'    =&gt; 'some-term', // The terms are not needed on the subsite.
			),
		),
	)
);

// Display posts.

restore_current_blog();</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6793' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6793%23feedback-editor-6793" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6806" data-comment-id="6806" class="comment byuser comment-author-crstauf even thread-odd thread-alt depth-1">
			<article id="div-comment-6806" class="comment-body">

							<a href="#comment-content-6806" class="screen-reader-text">Skip to note 52 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/crstauf/" rel="external nofollow">crstauf</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6806">
							<time datetime="2023-12-06T03:56:39+00:00">
							3 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="5764ef0ccb" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6806" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6806"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="100% like this"><span class="screen-reader-text">Vote results for this note: </span>1</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6806" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6806"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6806">
				<p>In WordPress 6.2+, within `<a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a>` you can set `search_columns` parameter (not documented at time of writing) to specify the fields to search:</p>
<pre class="wp-block-code"><code lang="php" class="language-php ">$query = new WP_Query( array(
    's'              =&gt; 'search term',
    'search_columns' =&gt; array( 'post_content', 'post_name', 'post_title' ),
) );</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6806' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='2'>
<ul class='children'>
			<li id="comment-7100" data-comment-id="7100" class="comment byuser comment-author-ashkanahmadi odd alt depth-2">
			<article id="div-comment-7100" class="comment-body">

			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-7100">
				<div>Thanks for sharing. That&#8217;s great to know. Is it possible to add ACF fields here as well or those still have to be done through <code>meta_query</code>?</div>
<div><a href="https://profiles.wordpress.org/ashkanahmadi/" rel="external nofollow" class="url">ashkanahmadi</a> <a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-7100"><time datetime="2024-07-17T12:36:49+00:00">2 years ago</time></a></div>
				</div><!-- .comment-content -->

						</article>
			</li>
								<li id="comment-7103" data-comment-id="7103" class="comment byuser comment-author-crstauf even depth-2">
			<article id="div-comment-7103" class="comment-body">

			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-7103">
				<div>@ashkanahmadi The <code>search_columns</code> parameter is limited to those three columns in the <code>wp_posts</code> table.</div>
<div><a href="https://profiles.wordpress.org/crstauf/" rel="external nofollow" class="url">crstauf</a> <a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-7103"><time datetime="2024-07-18T20:04:44+00:00">2 years ago</time></a></div>
				</div><!-- .comment-content -->

						</article>
			</li>
					</ul>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6806%23feedback-editor-6806" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-2315" data-comment-id="2315" class="comment byuser comment-author-dougal odd alt thread-even depth-1">
			<article id="div-comment-2315" class="comment-body">

							<a href="#comment-content-2315" class="screen-reader-text">Skip to note 53 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/dougal/" rel="external nofollow">Dougal Campbell</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-2315">
							<time datetime="2017-08-04T13:44:49+00:00">
							9 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="625082f4ed" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="2315" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2315"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="50% like this"><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="2315" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-2315"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-2315">
				<p>Just a note &#8212; if you ever have occasion to use a <code>NOT EXISTS</code> clause, this will generate a sub-select in the SQL, which could be a performance problem in high-traffic environments. </p>
<p>For example:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = &#091;
            'post_type' =&gt; 'post',
            'post_status' =&gt; 'publish',
            'posts_per_page' =&gt; 1,
            'tax_query' =&gt; &#091;
                'relation' =&gt; 'OR',
                &#091;
                    'taxonomy' =&gt; 'team',
                    'field' =&gt; 'slug',
                    'terms' =&gt; $team_slug,
                &#093;,
	            &#091;
		            'taxonomy' =&gt; 'team',
		            'field' =&gt; 'id',
		            'operator' =&gt; 'NOT EXISTS',
	            &#093;,
            &#093;,
            'date_query' =&gt; &#091;
                &#091;
                    'before' =&gt; $post_date,
                    'inclusive' =&gt; false,
                &#093;
            &#093;,
            'ignore_sticky_posts' =&gt; 1,
        &#093;;</code></pre>
<p>This is a &#8220;previous post&#8221; query that tries to match the same &#8216;team&#8217; taxonomy term of the current post, or a post with no &#8216;team&#8217; taxonomy term set. We deployed code similar to this on a high-traffic site, and it immediately ran into problems due to the MySQL load. Fortunately, we were able to implement an alternative quickly.</p>
<p>I would recommend doing load testing in a test environment if you find yourself needing to use <code>EXISTS</code> or <code>NOT EXISTS</code>.</p>
				</div><!-- .comment-content -->

					<section id='feedback-2315' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D2315%23feedback-editor-2315" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-3334" data-comment-id="3334" class="comment byuser comment-author-destabilizator even thread-odd thread-alt depth-1">
			<article id="div-comment-3334" class="comment-body">

							<a href="#comment-content-3334" class="screen-reader-text">Skip to note 54 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/destabilizator/" rel="external nofollow">destabilizator</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-3334">
							<time datetime="2019-08-10T11:10:53+00:00">
							7 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="94721561e8" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="3334" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3334"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="3334" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3334"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-3334">
				<p>Very handy example how to only order by multiple meta keys (taken from Stack Overflow)</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
    'post_type'  =&gt; 'event',
    'meta_query' =&gt; array(
        'relation' =&gt; 'AND',
        'event_start_date_clause' =&gt; array(
            'key'     =&gt; '_event_start_date',
            'compare' =&gt; 'EXISTS',
        ),
        'event_start_time_clause' =&gt; array(
            'key'     =&gt; '_event_start_time',
            'compare' =&gt; 'EXISTS',
        ), 
    ),
    'orderby' =&gt; array(
        'event_start_date_clause' =&gt; 'ASC',
        'event_start_time_clause' =&gt; 'ASC',
    ),
);</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-3334' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D3334%23feedback-editor-3334" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5474" data-comment-id="5474" class="comment byuser comment-author-jawad1234 odd alt thread-even depth-1">
			<article id="div-comment-5474" class="comment-body">

							<a href="#comment-content-5474" class="screen-reader-text">Skip to note 55 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/jawad1234/" rel="external nofollow">Muhammad Jawad Abbasi</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5474">
							<time datetime="2021-11-13T16:39:48+00:00">
							5 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="a2fa91b7e6" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5474" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5474"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5474" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5474"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5474">
				<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">&lt;?php
		
if(is_user_logged_in()){
   $args = array(
    'category_name' =&gt; 'Flowers',
    'post_status' =&gt; 'draft,publish',
    'posts_per_page' =&gt; 3,
   );
}
else{
    $args = array(
    'category_name' =&gt; 'Flowers',
    'post_status' =&gt; 'publish',
    'posts_per_page' =&gt; 3,
);  	
}

$flowerposts = new WP_query($args);

if($flowerposts-&gt;have_posts()):
   while($flowerposts-&gt;have_posts()) : $flowerposts-&gt;the_post();
   ?&gt;
  &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
  &lt;p&gt;&lt;?php the_content(); ?&gt;
  &lt;/p&gt;

&lt;?php

endwhile;
endif;

?&gt;</code></pre>
<p><strong>Output:</strong><br />
User login show 3 recent &#8220;Flowers Category&#8221; publish &amp; draft posts<br />
User don&#8217;t log in show 3 recent &#8220;Flowers Category&#8221; publish posts just</p>
				</div><!-- .comment-content -->

					<section id='feedback-5474' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5474%23feedback-editor-5474" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-5759" data-comment-id="5759" class="comment byuser comment-author-miguelitomola even thread-odd thread-alt depth-1">
			<article id="div-comment-5759" class="comment-body">

							<a href="#comment-content-5759" class="screen-reader-text">Skip to note 56 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/miguelitomola/" rel="external nofollow">miguelitomola</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5759">
							<time datetime="2022-04-01T14:56:49+00:00">
							5 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="86a195821e" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="5759" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5759"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="5759" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-5759"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5759">
				<p>To query posts in a specific taxonomy, the &#8216;taxonomy&#8217; parameter is <strong>required</strong>.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">// For example to get WC products in category 254: 
$args = array(
    'tax_query'     =&gt; array(
        array(
            'taxonomy'  =&gt; 'product_cat', // required
            'terms'     =&gt;  254
        ),
    ),
    'post_type'     =&gt; 'product'
);

$query = new WP_Query( $args );</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-5759' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D5759%23feedback-editor-5759" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6349" data-comment-id="6349" class="comment byuser comment-author-muze233 odd alt thread-even depth-1">
			<article id="div-comment-6349" class="comment-body">

							<a href="#comment-content-6349" class="screen-reader-text">Skip to note 57 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/muze233/" rel="external nofollow">Npcink</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6349">
							<time datetime="2023-02-16T03:43:51+00:00">
							4 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="a965b3dcca" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6349" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6349"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6349" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6349"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6349">
				<p>For the function code in the demonstration, the number of articles published today will be obtained, and the articles with the status of public release and top will be counted. Not accurate., If you want to get the number of articles posted today, you need to exclude the topmost articles, please refer to the following code:</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">       function wpdocs_get_articles_count_today() {
            $today = getdate();
            $args = array(
                'post_type' =&gt; 'post', 
                'post_status' =&gt; 'publish', 
                //'post__not_in' =&gt; get_option( 'sticky_posts' ), // Exclude top articles
                'date_query' =&gt; array( //time
                    array(
                        'year' =&gt; $today&#091;'year'&#093;,
                        'month' =&gt; $today&#091;'mon'&#093;,
                        'day' =&gt; $today&#091;'mday'&#093;,
                    ),
                ),
            );

            $query = new WP_Query( $args );

            return $query-&gt;post_count;
        }</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6349' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6349%23feedback-editor-6349" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6442" data-comment-id="6442" class="comment byuser comment-author-presskopp even thread-odd thread-alt depth-1">
			<article id="div-comment-6442" class="comment-body">

							<a href="#comment-content-6442" class="screen-reader-text">Skip to note 58 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/presskopp/" rel="external nofollow">Presskopp</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6442">
							<time datetime="2023-04-16T05:57:42+00:00">
							3 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="3327a462fa" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6442" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6442"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6442" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6442"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6442">
				<p><em>meta_value_datetime</em> to define order structure is not working at all, see <a href="https://core.trac.wordpress.org/ticket/50081" rel="nofollow ugc">https://core.trac.wordpress.org/ticket/50081</a></p>
				</div><!-- .comment-content -->

					<section id='feedback-6442' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6442%23feedback-editor-6442" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6607" data-comment-id="6607" class="comment byuser comment-author-yaniiliev odd alt thread-even depth-1">
			<article id="div-comment-6607" class="comment-body">

							<a href="#comment-content-6607" class="screen-reader-text">Skip to note 59 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/yaniiliev/" rel="external nofollow">Yani</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6607">
							<time datetime="2023-08-08T08:52:16+00:00">
							3 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="6bf702e79d" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6607" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6607"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6607" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6607"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6607">
				<p>The standard loop example can be optimized a little. <code>wp_reset_postdata()</code> needs to be called only if the <code>the_post()</code> method has been used to alter the global <code>$post</code> variable.</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">// The Query.
$the_query = new WP_Query( $args );

// The Loop.
if ( $the_query-&gt;have_posts() ) {
	echo '&lt;ul&gt;';

	while ( $the_query-&gt;have_posts() ) {
		$the_query-&gt;the_post();
		echo '&lt;li&gt;' . esc_html( get_the_title() ) . '&lt;/li&gt;';
	}

	echo '&lt;/ul&gt;';

	// Restore original Post Data.
	wp_reset_postdata();
} else {
	esc_html_e( 'Sorry, no posts matched your criteria.' );
}</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6607' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6607%23feedback-editor-6607" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-6804" data-comment-id="6804" class="comment byuser comment-author-ngolwalkar8 even thread-odd thread-alt depth-1">
			<article id="div-comment-6804" class="comment-body">

							<a href="#comment-content-6804" class="screen-reader-text">Skip to note 60 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/ngolwalkar8/" rel="external nofollow">ngolwalkar8</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-6804">
							<time datetime="2023-12-05T14:13:34+00:00">
							3 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="fa58057e3f" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="6804" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6804"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="6804" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-6804"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-6804">
				<p>You can use &#8216;title&#8217; param to get the posts or any custom post type by title, which was added to WP version 4.4</p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">$args = array(
	'post_type' =&gt; 'ANY_POST_TYPE',
	'title'     =&gt; 'Hello' // It seems to be case sensitive, so 'hello' and 'Hello' both are different.
);
$posts = new WP_Query( $args );</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-6804' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D6804%23feedback-editor-6804" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-7209" data-comment-id="7209" class="comment byuser comment-author-jakeparis odd alt thread-even depth-1">
			<article id="div-comment-7209" class="comment-body">

							<a href="#comment-content-7209" class="screen-reader-text">Skip to note 61 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/jakeparis/" rel="external nofollow">jakeparis</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-7209">
							<time datetime="2024-11-13T18:29:35+00:00">
							2 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="c4a9614758" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="7209" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-7209"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title=""><span class="screen-reader-text">Vote results for this note: </span>0</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="7209" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-7209"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-7209">
				<p><strong>Getting all posts with a specific meta_key and an empty meta_value</strong></p>
<p>If you are trying to get all posts which have a specific meta_key (for example <code>flower</code>), and have an empty string for the corresponding <code>meta_value</code>, using the simple form of the meta arguments will <i>not</i> work. You must use the <code>meta_query</code> key with the nested array.</p>
<p><strong>DOESN’T WORK</strong></p>
<pre class="wp-block-code"><code lang="php" class="language-php ">get_posts( array(
   'meta_key' =&gt; 'flower',
   'meta_value' =&gt; ''
 );</code></pre>
<p><strong>WORKS</strong></p>
<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">get_posts( array(
  'meta_query' =&gt; array(
    array(
      'key' =&gt; 'flower',
      'value' =&gt; '',
    ),
  ),
);</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-7209' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D7209%23feedback-editor-7209" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-4283" data-comment-id="4283" class="comment byuser comment-author-josaffe even thread-odd thread-alt depth-1 bad-note">
			<article id="div-comment-4283" class="comment-body">

							<a href="#comment-content-4283" class="screen-reader-text">Skip to note 62 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/josaffe/" rel="external nofollow">josaffe</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-4283">
							<time datetime="2020-09-22T08:12:22+00:00">
							6 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="52771fb5fc" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="4283" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-4283"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="0% like this"><span class="screen-reader-text">Vote results for this note: </span>-2</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="4283" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-4283"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-4283">
				<p>Seems like you can use an array for the <code>cat</code> parameter, too.</p>
<p>See line 1149:</p>
<pre class="wp-block-code"><code lang="php" class="language-php ">// If query string 'cat' is an array, implode it.
if ( is_array( $q&#091;'cat'&#093; ) ) {
	$q&#091;'cat'&#093; = implode( ',', $q&#091;'cat'&#093; );
}</code></pre>
				</div><!-- .comment-content -->

					<section id='feedback-4283' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D4283%23feedback-editor-4283" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-3931" data-comment-id="3931" class="comment byuser comment-author-odedv odd alt thread-even depth-1 bad-note">
			<article id="div-comment-3931" class="comment-body">

							<a href="#comment-content-3931" class="screen-reader-text">Skip to note 63 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/odedv/" rel="external nofollow">odedv</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-3931">
							<time datetime="2020-06-03T10:53:59+00:00">
							6 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="e27f9a59d9" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="3931" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3931"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="13% like this"><span class="screen-reader-text">Vote results for this note: </span>-6</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="3931" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-3931"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-3931">
				<p><code>WP_Query</code> doesn&#8217;t always generate optimized queries, and by default there might be missing indexes, which can lead to performance issues and slow response.</p>
<p>For example, In the <code>wp_postmeta</code> table, I suggest considering to remove the meta_value from the index, because it is a largetext type, which cannot be indexed.</p>
<p>I would recommend that you will try analyzing your database to see if there are missing or redundant indexes. you can use <a href="https://www.eversql.com/" rel="nofollow ugc">EverSQL</a> for that. (Disclaimer: I am EverSQL&#8217;s co-founder)</p>
				</div><!-- .comment-content -->

					<section id='feedback-3931' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='0'>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D3931%23feedback-editor-3931" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
			<li id="comment-83" data-comment-id="83" class="comment byuser comment-author-leocaseiro even thread-odd thread-alt depth-1 bad-note">
			<article id="div-comment-83" class="comment-body">

							<a href="#comment-content-83" class="screen-reader-text">Skip to note 64 content</a>
				<header class="comment-meta">
					<div class="comment-author vcard">
						<span class="comment-author-attribution">
						<a class="url" href="https://profiles.wordpress.org/leocaseiro/" rel="external nofollow">Leo Caseiro</a>						</span>
						<a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-83">
							<time datetime="2014-10-13T17:21:27+00:00">
							12 years ago							</time>
						</a>

																													</div>
					<div class="user-note-voting" data-nonce="945ad4a753" data-can-vote="false"><a class="user-note-voting-up" title="You must log in to vote on the helpfulness of this note" data-id="83" data-vote="up" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-83"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a><span class="user-note-voting-count " title="33% like this"><span class="screen-reader-text">Vote results for this note: </span>-12</span><a class="user-note-voting-down" title="You must log in to vote on the helpfulness of this note" data-id="83" data-vote="down" href="https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%23comment-83"><span class="screen-reader-text">You must log in to vote on the helpfulness of this note</span></a></div>				</header>
				<!-- .comment-metadata -->
			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-83">
				<p>A great way to learn about <code>WP_Query</code> is watching this talk:</p>
<p><a href="http://wordpress.tv/2013/03/15/andrew-nacin-wp_query-wordpress-in-depth/" rel="nofollow ugc">http://wordpress.tv/2013/03/15/andrew-nacin-wp_query-wordpress-in-depth/</a></p>
				</div><!-- .comment-content -->

					<section id='feedback-83' class='wporg-has-embedded-code feedback hide-if-js' data-comment-count='1'>
<ul class='children'>
			<li id="comment-5481" data-comment-id="5481" class="comment byuser comment-author-amilgrom odd alt depth-2">
			<article id="div-comment-5481" class="comment-body">

			
				<div class="wporg-has-embedded-code comment-content" id="comment-content-5481">
				<div>I found some strange behavior with <a href="https://developer.wordpress.org/reference/classes/wp_query/" rel="class">WP_Query</a> and query_posts when running it in an AJAX call with sort parameters.  When I set it to sort by &#8216;title&#8217; it would attempt to sort by meta_value with the meta_key of &#8216;title&#8217;.  To fix this, I had to change the orderby value to &#8216;post_title&#8217;.  So this does not work as expected: </p>
<pre class="wp-block-code"><code lang="php" class="language-php ">$the_query = new WP_Query( 	array( 		'orderby' =&amp;gt; 'title' 		'order'   =&amp;gt; 'ASC' 	) );</code></pre>
<p>  This does work: </p>
<pre class="wp-block-code"><code lang="php" class="language-php ">$the_query = new WP_Query( 	array( 		'orderby' =&amp;gt; 'post_title' 		'order'   =&amp;gt; 'ASC' 	) );</code></pre>
</div>
<div><a href="https://profiles.wordpress.org/amilgrom/" rel="external nofollow" class="url">Aaron</a> <a class="comment-date" href="https://developer.wordpress.org/reference/classes/wp_query/#comment-5481"><time datetime="2021-11-16T14:57:27+00:00">5 years ago</time></a></div>
				</div><!-- .comment-content -->

						</article>
			</li>
					</ul>
</section><!-- .feedback -->
<footer class='feedback-links wporg-dot-link-list' >
<a role="button" class="feedback-login" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F%3Freplytocom%3D83%23feedback-editor-83" rel="nofollow">Log in to add feedback</a></footer>
</article><!-- .comment-body -->
</li>
</ol></section>
	</div>


				<section class="wp-block-wporg-code-reference-comment-form"> <p>You must <a href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2F">log in</a> before being able to contribute a note or feedback.</p></section>

			</article>
			

		</main>
		

	</div>
	

</div>


<div class="wporg-footer wp-block-template-part"><footer class="global-footer wp-block-group wp-block-wporg-global-footer">

<nav class="wp-block-group alignfull global-footer__navigation-container is-layout-grid wp-container-core-group-is-layout-3fccc9c5 wp-block-group-is-layout-grid" aria-label="Footer">
	
	<ul class="wp-block-list">
		
		<li><a href="https://wordpress.org/about/">About</a></li>
		
		
		<li><a href="https://wordpress.org/news/">News</a></li>
		
		
		<li><a href="https://wordpress.org/hosting/">Hosting</a></li>
		
		
		<li><a href="https://wordpress.org/about/privacy/">Privacy</a></li>
		
	</ul>
	

	
	<ul class="wp-block-list">
		
		<li><a href="https://wordpress.org/showcase/">Showcase</a></li>
		
		
		<li><a href="https://wordpress.org/themes/">Themes</a></li>
		
		
		<li><a href="https://wordpress.org/plugins/">Plugins</a></li>
		
		
		<li><a href="https://wordpress.org/patterns/">Patterns</a></li>
		
	</ul>
	

	
	<ul class="wp-block-list">
		
		<li><a href="https://learn.wordpress.org/">Learn</a></li>
		
					
			<li><a href="https://wordpress.org/documentation/">Documentation</a></li>
			
				
		<li><a href="https://developer.wordpress.org/">Developers</a></li>
		
		
		<li><a href="https://wordpress.tv/">WordPress.tv <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
	</ul>
	

	
	<ul class="wp-block-list">
		
		<li><a href="https://make.wordpress.org/">Get Involved</a></li>
		
		
		<li><a href="https://events.wordpress.org/">Events</a></li>
		
		
		<li><a href="https://wordpressfoundation.org/donate/">Donate <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
		
		<li><a href="https://mercantile.wordpress.org/">Swag <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
	</ul>
	

	
	<ul class="wp-block-list">
		
		<li><a href="https://wordpress.com/?ref=wporg-footer">WordPress.com <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
		
		<li><a href="https://ma.tt/">Matt <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
		
		<li><a href="https://bbpress.org/">bbPress <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
		
		<li><a href="https://buddypress.org/">BuddyPress <span aria-hidden="true" class="wp-exclude-emoji">↗</span></a></li>
		
	</ul>
	
</nav>



<div class="wp-block-group global-footer__logos-container is-layout-flow wp-block-group-is-layout-flow">
	
	<div class="wp-block-group global-footer__wporg-container is-layout-flow wp-block-group-is-layout-flow">
		
		<div class="wp-block-group is-content-justification-left is-nowrap is-layout-flex wp-container-core-group-is-layout-e1f0195b wp-block-group-is-layout-flex">
			
			<figure class="wp-block-image global-footer__wporg-logo-full">
				<a href="https://wordpress.org/">
					<svg xmlns="http://www.w3.org/2000/svg" role="img" width="329" height="52" viewBox="0 0 329 52">
	<title>WordPress.org</title>
	<path fill="currentColor" d="M4.33 26a21.68 21.68 0 0 0 12.22 19.5L6.21 17.18A21.66 21.66 0 0 0 4.33 26ZM26.38 27.89l-6.5 18.89a21.31 21.31 0 0 0 6.12.89 21.77 21.77 0 0 0 7.2-1.23 1.429 1.429 0 0 1-.16-.3l-6.66-18.25Z"/>
	<path fill="currentColor" d="M26 0a26 26 0 1 0 0 52 26 26 0 0 0 0-52Zm20.27 39.66a24.47 24.47 0 0 1-29.78 8.86 24.49 24.49 0 0 1-13-13 24.4 24.4 0 0 1 5.23-26.8 24.46 24.46 0 0 1 26.79-5.24 24.49 24.49 0 0 1 13 13 24.42 24.42 0 0 1-2.25 23.17l.01.01Z"/>
	<path fill="currentColor" d="M45 15.61c.103.736.153 1.477.15 2.22a20.38 20.38 0 0 1-1.65 7.76l-6.61 19.14A21.65 21.65 0 0 0 45 15.61ZM40.63 24.91a11.45 11.45 0 0 0-1.79-6c-1.1-1.78-2.13-3.29-2.13-5.08A3.76 3.76 0 0 1 40.35 10h.28A21.65 21.65 0 0 0 7.9 14.1h1.39c2.27 0 5.78-.27 5.78-.27a.9.9 0 0 1 .13 1.79s-1.17.13-2.47.2l7.88 23.47 4.75-14.22L22 15.84c-1.17-.07-2.27-.2-2.27-.2a.9.9 0 0 1 .14-1.79s3.57.27 5.7.27c2.13 0 5.78-.27 5.78-.27a.9.9 0 0 1 .14 1.79s-1.18.13-2.48.2l7.83 23.29 2.23-7.08a25.171 25.171 0 0 0 1.56-7.14ZM145.83 19.3h-10.34v1.1c3.23 0 3.75.69 3.75 4.79v7.4c0 4.1-.52 4.85-3.75 4.85-2.48-.35-4.16-1.68-6.47-4.22l-2.66-2.89c3.58-.63 5.49-2.89 5.49-5.43 0-3.18-2.72-5.6-7.8-5.6h-10.17v1.1c3.24 0 3.76.69 3.76 4.79v7.4c0 4.1-.52 4.85-3.76 4.85v1.1h11.5v-1.1c-3.24 0-3.76-.75-3.76-4.85v-2.08h1l6.42 8h16.81c8.26 0 11.85-4.39 11.85-9.65 0-5.26-3.61-9.56-11.87-9.56Zm-24.21 9.42V21H124a3.551 3.551 0 0 1 3.76 3.87 3.536 3.536 0 0 1-3.76 3.85h-2.38Zm24.38 8h-.4c-2.08 0-2.37-.52-2.37-3.18V21H146c6 0 7.11 4.39 7.11 7.8S152 36.75 146 36.75v-.03ZM93.49 13.52H82.62v1.16c3.7 0 4.22 1 3.07 4.39l-4 11.78L76 13.52h-1.1l-5.85 17.33-3.87-11.78c-1.22-3.59-.29-4.39 3.12-4.39v-1.16H55.47v1.16c3.35 0 4.28.86 5.66 5.08l6.42 19.76h.75l6-18.08 5.9 18.08h.8l6.59-19.76c1.44-4.22 2.31-5.08 5.95-5.08l-.05-1.16ZM101.34 18.55c-6.35 0-11.55 4.68-11.55 10.34s5.2 10.4 11.55 10.4c6.35 0 11.56-4.68 11.56-10.4 0-5.72-5.2-10.34-11.56-10.34Zm0 18.89c-5.31 0-7.16-4.74-7.16-8.55 0-3.81 1.85-8.55 7.16-8.55 5.31 0 7.23 4.79 7.23 8.55 0 3.76-1.85 8.55-7.23 8.55ZM170.67 13.52h-12v1.16c3.88 0 4.57.92 4.57 6.7v9.24c0 5.78-.69 6.76-4.57 6.76v1.16H172v-1.16c-3.88 0-4.57-1-4.57-6.76v-2.83h3.29c6 0 9.25-3.12 9.25-7.11s-3.35-7.16-9.3-7.16Zm0 12.13h-3.29v-10h3.29c3.24 0 4.74 2.31 4.74 5.08s-1.5 4.92-4.74 4.92ZM219.32 34.15c-.52 1.9-1.15 2.6-5.26 2.6h-.81c-3 0-3.52-.7-3.52-4.8v-2.66c4.51 0 4.85.41 4.85 3.41h1.1v-8.61h-1.1c0 3-.34 3.41-4.85 3.41V21h3.18c4.1 0 4.74.69 5.26 2.6l.28 1.1h.93l-.38-5.4h-17v1.1c3.23 0 3.75.69 3.75 4.79v7.4c0 3.75-.44 4.69-3 4.83-2.42-.37-4.09-1.69-6.37-4.2l-2.65-2.89c3.58-.63 5.49-2.89 5.49-5.43 0-3.18-2.72-5.6-7.8-5.6h-10.17v1.1c3.23 0 3.75.69 3.75 4.79v7.4c0 4.1-.52 4.85-3.75 4.85v1.1h11.49v-1.1c-3.23 0-3.75-.75-3.75-4.85v-2.08h1l6.41 8h23.75l.35-5.43h-.87l-.31 1.07ZM189 28.72V21h2.37a3.542 3.542 0 0 1 3.75 3.87 3.532 3.532 0 0 1-.998 2.77 3.532 3.532 0 0 1-2.752 1.05l-2.37.03ZM234.52 27.91l-3.18-1.56c-2.78-1.27-4-2.08-4-3.59 0-1.51 1.5-2.36 3.12-2.36 3.06 0 4.57 2.25 5 5h1.21v-6.85h-1.09a3.415 3.415 0 0 1-.75 1.56 7.25 7.25 0 0 0-4.51-1.5c-3.58 0-6.18 2.36-6.18 5.14 0 2.54 1.73 4.45 4 5.54l3.29 1.56c2.37 1.1 3.7 2.26 3.7 3.76 0 1.73-1.5 2.77-3.35 2.77-3.41 0-6.07-2.25-6.53-6.06h-1.15v8h1.09a4.194 4.194 0 0 1 .93-2 8.481 8.481 0 0 0 5.2 2c3.87 0 7-2.54 7-6.18.07-1.77-1.03-3.9-3.8-5.23ZM252 27.91l-3.18-1.56c-2.78-1.27-4-2.08-4-3.59 0-1.51 1.5-2.36 3.12-2.36 3.06 0 4.57 2.25 5 5h1.21v-6.85H253a3.415 3.415 0 0 1-.75 1.56 7.25 7.25 0 0 0-4.51-1.5c-3.58 0-6.18 2.36-6.18 5.14 0 2.54 1.73 4.45 4 5.54l3.29 1.56c2.37 1.1 3.7 2.26 3.7 3.76 0 1.73-1.5 2.77-3.35 2.77-3.41 0-6.07-2.25-6.53-6.06h-1.15v8h1.09a4.194 4.194 0 0 1 .93-2 8.481 8.481 0 0 0 5.2 2c3.87 0 7.05-2.54 7.05-6.18.07-1.77-1.03-3.9-3.79-5.23ZM277.56 18.75a10.481 10.481 0 0 0-10.68 10.17 10.47 10.47 0 0 0 10.68 10.16c5.9 0 10.71-4.58 10.71-10.16s-4.81-10.17-10.71-10.17Zm0 19c-5.52 0-7.63-4.91-7.63-8.88 0-3.97 2.07-8.87 7.63-8.87 5.56 0 7.66 4.94 7.66 8.92 0 3.98-2.11 8.88-7.66 8.88v-.05ZM301.71 33.79l-3.14-3.69c3.63-.38 5.71-2.59 5.71-5.38 0-3-2.44-5.42-6.89-5.42h-8.47v.7c2.66 0 3.05.51 3.05 3.72v10.39c0 3.21-.39 3.76-3.05 3.76v.67h8.66v-.67c-2.66 0-3.05-.55-3.05-3.76v-4H296l6.35 8.44h5.29v-.67c-1.88-.24-4.03-1.88-5.93-4.09ZM294.53 29v-8.52h2.82c2.79 0 4.08 1.93 4.08 4.24 0 2.31-1.29 4.28-4.08 4.28h-2.82ZM319.6 30.59v.64c2.21 0 3 .7 3 2.08 0 2.89-2.5 4.39-5.29 4.39-5.93 0-7.6-4.81-7.6-8.78 0-3.97 1.86-8.92 7-8.92 3.59 0 6.09 2.54 7 6.7h.64v-7h-.64a3.281 3.281 0 0 1-1.09 1.83 8.203 8.203 0 0 0-6-2.73 10.167 10.167 0 0 0-9.851 10.165 10.169 10.169 0 0 0 9.851 10.165c3.34 0 4.78-1.66 8.34-1.66V35c0-3.21.39-3.75 3.05-3.75v-.64l-8.41-.02ZM261.9 34.77a2.061 2.061 0 1 0 .288 4.112 2.061 2.061 0 0 0-.288-4.112Z"/>
</svg>				</a>
			</figure>
			

					</div>
		

		
		<p class="global-footer__trademark wp-block-paragraph">
			The WordPress&reg; trademark is the intellectual property of the WordPress Foundation.		</p>
		
	</div>
	

	
	<ul class="wp-block-social-links is-style-logos-only is-layout-flex wp-block-social-links-is-layout-flex">
		<li class="wp-social-link wp-social-link-x wp-block-social-link"><a href="https://www.x.com/WordPress" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">Visit our X (formerly Twitter) account</span></a></li>
		<li class="wp-social-link wp-social-link-bluesky wp-block-social-link"><a href="https://bsky.app/profile/wordpress.org" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M6.3,4.2c2.3,1.7,4.8,5.3,5.7,7.2.9-1.9,3.4-5.4,5.7-7.2,1.7-1.3,4.3-2.2,4.3.9s-.4,5.2-.6,5.9c-.7,2.6-3.3,3.2-5.6,2.8,4,.7,5.1,3,2.9,5.3-5,5.2-6.7-2.8-6.7-2.8,0,0-1.7,8-6.7,2.8-2.2-2.3-1.2-4.6,2.9-5.3-2.3.4-4.9-.3-5.6-2.8-.2-.7-.6-5.3-.6-5.9,0-3.1,2.7-2.1,4.3-.9h0Z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Visit our Bluesky account</span></a></li>
		<li class="wp-social-link wp-social-link-mastodon wp-block-social-link"><a rel="me" href="https://mastodon.world/@WordPress" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M23.193 7.879c0-5.206-3.411-6.732-3.411-6.732C18.062.357 15.108.025 12.041 0h-.076c-3.068.025-6.02.357-7.74 1.147 0 0-3.411 1.526-3.411 6.732 0 1.192-.023 2.618.015 4.129.124 5.092.934 10.109 5.641 11.355 2.17.574 4.034.695 5.535.612 2.722-.15 4.25-.972 4.25-.972l-.09-1.975s-1.945.613-4.129.539c-2.165-.074-4.449-.233-4.799-2.891a5.499 5.499 0 0 1-.048-.745s2.125.52 4.817.643c1.646.075 3.19-.097 4.758-.283 3.007-.359 5.625-2.212 5.954-3.905.517-2.665.475-6.507.475-6.507zm-4.024 6.709h-2.497V8.469c0-1.29-.543-1.944-1.628-1.944-1.2 0-1.802.776-1.802 2.312v3.349h-2.483v-3.35c0-1.536-.602-2.312-1.802-2.312-1.085 0-1.628.655-1.628 1.944v6.119H4.832V8.284c0-1.289.328-2.313.987-3.07.68-.758 1.569-1.146 2.674-1.146 1.278 0 2.246.491 2.886 1.474L12 6.585l.622-1.043c.64-.983 1.608-1.474 2.886-1.474 1.104 0 1.994.388 2.674 1.146.658.757.986 1.781.986 3.07v6.304z"/></svg><span class="wp-block-social-link-label screen-reader-text">Visit our Mastodon account</span></a></li>
		<li class="wp-social-link wp-social-link-threads wp-block-social-link"><a href="https://www.threads.net/@wordpress" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M16.3 11.3c-.1 0-.2-.1-.2-.1-.1-2.6-1.5-4-3.9-4-1.4 0-2.6.6-3.3 1.7l1.3.9c.5-.8 1.4-1 2-1 .8 0 1.4.2 1.7.7.3.3.5.8.5 1.3-.7-.1-1.4-.2-2.2-.1-2.2.1-3.7 1.4-3.6 3.2 0 .9.5 1.7 1.3 2.2.7.4 1.5.6 2.4.6 1.2-.1 2.1-.5 2.7-1.3.5-.6.8-1.4.9-2.4.6.3 1 .8 1.2 1.3.4.9.4 2.4-.8 3.6-1.1 1.1-2.3 1.5-4.3 1.5-2.1 0-3.8-.7-4.8-2S5.7 14.3 5.7 12c0-2.3.5-4.1 1.5-5.4 1.1-1.3 2.7-2 4.8-2 2.2 0 3.8.7 4.9 2 .5.7.9 1.5 1.2 2.5l1.5-.4c-.3-1.2-.8-2.2-1.5-3.1-1.3-1.7-3.3-2.6-6-2.6-2.6 0-4.7.9-6 2.6C4.9 7.2 4.3 9.3 4.3 12s.6 4.8 1.9 6.4c1.4 1.7 3.4 2.6 6 2.6 2.3 0 4-.6 5.3-2 1.8-1.8 1.7-4 1.1-5.4-.4-.9-1.2-1.7-2.3-2.3zm-4 3.8c-1 .1-2-.4-2-1.3 0-.7.5-1.5 2.1-1.6h.5c.6 0 1.1.1 1.6.2-.2 2.3-1.3 2.7-2.2 2.7z"/></svg><span class="wp-block-social-link-label screen-reader-text">Visit our Threads account</span></a></li>
		<li class="wp-social-link wp-social-link-facebook wp-block-social-link"><a href="https://www.facebook.com/WordPress/" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Visit our Facebook page</span></a></li>
		<li class="wp-social-link wp-social-link-instagram wp-block-social-link"><a href="https://www.instagram.com/wordpress/" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,4.622c2.403,0,2.688,0.009,3.637,0.052c0.877,0.04,1.354,0.187,1.671,0.31c0.42,0.163,0.72,0.358,1.035,0.673 c0.315,0.315,0.51,0.615,0.673,1.035c0.123,0.317,0.27,0.794,0.31,1.671c0.043,0.949,0.052,1.234,0.052,3.637 s-0.009,2.688-0.052,3.637c-0.04,0.877-0.187,1.354-0.31,1.671c-0.163,0.42-0.358,0.72-0.673,1.035 c-0.315,0.315-0.615,0.51-1.035,0.673c-0.317,0.123-0.794,0.27-1.671,0.31c-0.949,0.043-1.233,0.052-3.637,0.052 s-2.688-0.009-3.637-0.052c-0.877-0.04-1.354-0.187-1.671-0.31c-0.42-0.163-0.72-0.358-1.035-0.673 c-0.315-0.315-0.51-0.615-0.673-1.035c-0.123-0.317-0.27-0.794-0.31-1.671C4.631,14.688,4.622,14.403,4.622,12 s0.009-2.688,0.052-3.637c0.04-0.877,0.187-1.354,0.31-1.671c0.163-0.42,0.358-0.72,0.673-1.035 c0.315-0.315,0.615-0.51,1.035-0.673c0.317-0.123,0.794-0.27,1.671-0.31C9.312,4.631,9.597,4.622,12,4.622 M12,3 C9.556,3,9.249,3.01,8.289,3.054C7.331,3.098,6.677,3.25,6.105,3.472C5.513,3.702,5.011,4.01,4.511,4.511 c-0.5,0.5-0.808,1.002-1.038,1.594C3.25,6.677,3.098,7.331,3.054,8.289C3.01,9.249,3,9.556,3,12c0,2.444,0.01,2.751,0.054,3.711 c0.044,0.958,0.196,1.612,0.418,2.185c0.23,0.592,0.538,1.094,1.038,1.594c0.5,0.5,1.002,0.808,1.594,1.038 c0.572,0.222,1.227,0.375,2.185,0.418C9.249,20.99,9.556,21,12,21s2.751-0.01,3.711-0.054c0.958-0.044,1.612-0.196,2.185-0.418 c0.592-0.23,1.094-0.538,1.594-1.038c0.5-0.5,0.808-1.002,1.038-1.594c0.222-0.572,0.375-1.227,0.418-2.185 C20.99,14.751,21,14.444,21,12s-0.01-2.751-0.054-3.711c-0.044-0.958-0.196-1.612-0.418-2.185c-0.23-0.592-0.538-1.094-1.038-1.594 c-0.5-0.5-1.002-0.808-1.594-1.038c-0.572-0.222-1.227-0.375-2.185-0.418C14.751,3.01,14.444,3,12,3L12,3z M12,7.378 c-2.552,0-4.622,2.069-4.622,4.622S9.448,16.622,12,16.622s4.622-2.069,4.622-4.622S14.552,7.378,12,7.378z M12,15 c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S13.657,15,12,15z M16.804,6.116c-0.596,0-1.08,0.484-1.08,1.08 s0.484,1.08,1.08,1.08c0.596,0,1.08-0.484,1.08-1.08S17.401,6.116,16.804,6.116z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Visit our Instagram account</span></a></li>
		<li class="wp-social-link wp-social-link-linkedin wp-block-social-link"><a href="https://www.linkedin.com/company/wordpress" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Visit our LinkedIn account</span></a></li>
		<li class="wp-social-link wp-social-link-tiktok wp-block-social-link"><a href="https://www.tiktok.com/@wordpress" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M16.708 0.027c1.745-0.027 3.48-0.011 5.213-0.027 0.105 2.041 0.839 4.12 2.333 5.563 1.491 1.479 3.6 2.156 5.652 2.385v5.369c-1.923-0.063-3.855-0.463-5.6-1.291-0.76-0.344-1.468-0.787-2.161-1.24-0.009 3.896 0.016 7.787-0.025 11.667-0.104 1.864-0.719 3.719-1.803 5.255-1.744 2.557-4.771 4.224-7.88 4.276-1.907 0.109-3.812-0.411-5.437-1.369-2.693-1.588-4.588-4.495-4.864-7.615-0.032-0.667-0.043-1.333-0.016-1.984 0.24-2.537 1.495-4.964 3.443-6.615 2.208-1.923 5.301-2.839 8.197-2.297 0.027 1.975-0.052 3.948-0.052 5.923-1.323-0.428-2.869-0.308-4.025 0.495-0.844 0.547-1.485 1.385-1.819 2.333-0.276 0.676-0.197 1.427-0.181 2.145 0.317 2.188 2.421 4.027 4.667 3.828 1.489-0.016 2.916-0.88 3.692-2.145 0.251-0.443 0.532-0.896 0.547-1.417 0.131-2.385 0.079-4.76 0.095-7.145 0.011-5.375-0.016-10.735 0.025-16.093z" /></svg><span class="wp-block-social-link-label screen-reader-text">Visit our TikTok account</span></a></li>
		<li class="wp-social-link wp-social-link-youtube wp-block-social-link"><a href="https://www.youtube.com/wordpress" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Visit our YouTube channel</span></a></li>
		<li class="wp-social-link wp-social-link-tumblr wp-block-social-link"><a href="https://wordpress.tumblr.com/" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Visit our Tumblr account</span></a></li>
	</ul> 
</div> 


<div class="wp-block-group global-footer__code-is-poetry-container is-layout-flow wp-block-group-is-layout-flow">
			<!-- Inline the graphic so it can use the MrsEaves outlines and inherit the footer colour. -->
		<svg xmlns="http://www.w3.org/2000/svg" role="img" width="188" height="13" viewBox="0 0 188 13" fill="currentColor">
<title>Code is Poetry</title>
<g>
<path d="M11.4863 12.4304V7.95462H11.0664C10.7724 9.27021 10.2264 10.3078 9.42845 11.0673C8.6445 11.8133 7.67855 12.1862 6.53062 12.1862C5.73267 12.1862 5.03971 12.0235 4.45174 11.698C3.86377 11.3589 3.3808 10.9113 3.00283 10.3552C2.63885 9.79917 2.37286 9.19562 2.20487 8.5446C2.03688 7.88002 1.95289 7.21544 1.95289 6.55086C1.95289 5.88628 2.03688 5.2217 2.20487 4.55712C2.37286 3.89254 2.63885 3.28221 3.00283 2.72613C3.3668 2.17006 3.84278 1.72926 4.43074 1.40376C5.03271 1.06468 5.73267 0.895149 6.53062 0.895149C7.67855 0.895149 8.6445 1.27491 9.42845 2.03443C10.2264 2.78039 10.7724 3.81795 11.0664 5.1471H11.4863V0.671361H11.0664C11.0244 0.90193 10.9334 1.12572 10.7934 1.34272C10.6534 1.55973 10.5064 1.72248 10.3524 1.83099C9.80643 1.27491 9.19746 0.847679 8.5255 0.549296C7.86754 0.250913 7.17458 0.101721 6.44662 0.101721C5.57867 0.101721 4.75272 0.271257 3.96877 0.610329C3.18481 0.935838 2.49185 1.39697 1.88989 1.99374C1.30192 2.59051 0.839951 3.28221 0.503971 4.06886C0.16799 4.8555 0 5.68284 0 6.55086C0 7.41888 0.16799 8.24622 0.503971 9.03286C0.839951 9.81951 1.30192 10.5112 1.88989 11.108C2.49185 11.7047 3.18481 12.1727 3.96877 12.5117C4.75272 12.8372 5.57867 13 6.44662 13C7.17458 13 7.86754 12.8508 8.5255 12.5524C9.19746 12.254 9.80643 11.8268 10.3524 11.2707C10.4924 11.3657 10.6324 11.5284 10.7724 11.759C10.9124 11.976 11.0104 12.1998 11.0664 12.4304H11.4863Z"/>
<path d="M30.3714 6.55086C30.3714 5.68284 30.1894 4.8555 29.8254 4.06886C29.4614 3.28221 28.9574 2.59051 28.3135 1.99374C27.6695 1.39697 26.9206 0.935838 26.0666 0.610329C25.2127 0.271257 24.3097 0.101721 23.3578 0.101721C22.4198 0.101721 21.5239 0.271257 20.6699 0.610329C19.816 0.935838 19.067 1.39697 18.4231 1.99374C17.7791 2.59051 17.2751 3.28221 16.9111 4.06886C16.5472 4.8555 16.3652 5.68284 16.3652 6.55086C16.3652 7.41888 16.5472 8.24622 16.9111 9.03286C17.2751 9.81951 17.7791 10.5112 18.4231 11.108C19.067 11.7047 19.816 12.1727 20.6699 12.5117C21.5239 12.8372 22.4198 13 23.3578 13C24.3097 13 25.2127 12.8372 26.0666 12.5117C26.9206 12.1727 27.6695 11.7047 28.3135 11.108C28.9574 10.5112 29.4614 9.81951 29.8254 9.03286C30.1894 8.24622 30.3714 7.41888 30.3714 6.55086ZM23.3578 0.895149C24.2257 0.895149 24.9817 1.06468 25.6256 1.40376C26.2696 1.72926 26.7946 2.17006 27.2005 2.72613C27.6065 3.28221 27.9005 3.89254 28.0825 4.55712C28.2785 5.2217 28.3765 5.88628 28.3765 6.55086C28.3765 7.21544 28.2785 7.88002 28.0825 8.5446C27.9005 9.19562 27.6065 9.79917 27.2005 10.3552C26.7946 10.9113 26.2696 11.3589 25.6256 11.698C24.9817 12.0235 24.2257 12.1862 23.3578 12.1862C22.4898 12.1862 21.7339 12.0235 21.0899 11.698C20.4599 11.3589 19.942 10.9113 19.536 10.3552C19.13 9.79917 18.829 9.19562 18.633 8.5446C18.451 7.88002 18.3601 7.21544 18.3601 6.55086C18.3601 5.88628 18.451 5.2217 18.633 4.55712C18.829 3.89254 19.13 3.28221 19.536 2.72613C19.942 2.17006 20.4599 1.72926 21.0899 1.40376C21.7339 1.06468 22.4898 0.895149 23.3578 0.895149Z"/>
<path d="M34.4572 12.6541H40.1478C41.3378 12.6541 42.3737 12.4982 43.2556 12.1862C44.1516 11.8743 44.8866 11.4403 45.4605 10.8842C46.0345 10.3281 46.4615 9.68388 46.7414 8.95149C47.0214 8.20553 47.1614 7.40532 47.1614 6.55086C47.1614 5.6964 47.0214 4.90297 46.7414 4.17058C46.4615 3.42462 46.0345 2.7736 45.4605 2.21753C44.8866 1.66145 44.1516 1.22744 43.2556 0.915493C42.3737 0.603547 41.3378 0.447574 40.1478 0.447574H34.4572V0.874804C34.9191 0.874804 35.2761 0.908711 35.5281 0.976526C35.7801 1.03078 35.9691 1.13928 36.0951 1.30203C36.2351 1.45123 36.3261 1.67501 36.368 1.9734C36.424 2.27178 36.452 2.69223 36.452 3.23474V9.84663C36.452 10.3891 36.424 10.8096 36.368 11.108C36.3261 11.4064 36.2351 11.6369 36.0951 11.7997C35.9691 11.9624 35.7801 12.0777 35.5281 12.1455C35.2761 12.1998 34.9191 12.2269 34.4572 12.2269V12.6541ZM38.132 1.20031C39.3219 1.20031 40.0008 1.20031 40.1688 1.20031C41.1488 1.20031 41.9677 1.35629 42.6257 1.66823C43.2836 1.98018 43.7946 2.40063 44.1586 2.92958C44.5226 3.44497 44.7746 4.01461 44.9146 4.6385C45.0685 5.24883 45.1455 5.88628 45.1455 6.55086C45.1455 7.21544 45.0685 7.85968 44.9146 8.48357C44.7746 9.0939 44.5226 9.65676 44.1586 10.1721C43.7946 10.6875 43.2836 11.108 42.6257 11.4335C41.9677 11.7454 41.1488 11.9014 40.1688 11.9014H40.0848C39.6229 11.9014 39.2659 11.8743 39.0139 11.82C38.7759 11.7522 38.5939 11.6437 38.4679 11.4945C38.3419 11.3318 38.2509 11.1012 38.1949 10.8028C38.1529 10.5044 38.132 10.084 38.132 9.54147V1.20031Z"/>
<path d="M51.253 12.6541H61.5424L61.7104 9.94836H61.2694L61.1644 10.3552C61.0104 10.952 60.7864 11.3589 60.4924 11.5759C60.2124 11.7929 59.6245 11.9014 58.7285 11.9014H56.9226C56.4607 11.9014 56.1037 11.8743 55.8517 11.82C55.5997 11.7522 55.4037 11.6437 55.2637 11.4945C55.1377 11.3318 55.0467 11.1012 54.9908 10.8028C54.9488 10.4909 54.9278 10.0704 54.9278 9.54147V6.5712H55.9777C56.5377 6.5712 56.9716 6.59833 57.2796 6.65258C57.5876 6.69327 57.8186 6.78143 57.9726 6.91706C58.1406 7.03912 58.2526 7.229 58.3086 7.4867C58.3786 7.73083 58.4136 8.07668 58.4136 8.52426H58.8545V3.86541H58.4136C58.4136 4.31299 58.3786 4.66562 58.3086 4.92332C58.2526 5.16745 58.1406 5.35733 57.9726 5.49296C57.8186 5.61502 57.5876 5.70318 57.2796 5.75743C56.9716 5.79812 56.5377 5.81847 55.9777 5.81847H54.9278V1.20031H58.0356C58.9315 1.20031 59.5195 1.30882 59.7995 1.52582C60.0795 1.72926 60.3034 2.12937 60.4714 2.72613L60.5764 3.13302H61.0174L60.8284 0.447574H51.253V0.874804C51.7149 0.874804 52.0719 0.908711 52.3239 0.976526C52.5759 1.03078 52.7649 1.13928 52.8909 1.30203C53.0309 1.45123 53.1219 1.67501 53.1639 1.9734C53.2199 2.27178 53.2479 2.69223 53.2479 3.23474V9.84663C53.2479 10.3891 53.2199 10.8096 53.1639 11.108C53.1219 11.4064 53.0309 11.6369 52.8909 11.7997C52.7649 11.9624 52.5759 12.0777 52.3239 12.1455C52.0719 12.1998 51.7149 12.2269 51.253 12.2269V12.6541Z"/>
<path d="M77.7181 12.6541V12.2269C77.2562 12.2269 76.8992 12.1998 76.6472 12.1455C76.3952 12.0777 76.1992 11.9624 76.0592 11.7997C75.9332 11.6369 75.8422 11.4064 75.7862 11.108C75.7442 10.8096 75.7232 10.3891 75.7232 9.84663V3.23474C75.7232 2.69223 75.7442 2.27178 75.7862 1.9734C75.8422 1.67501 75.9332 1.45123 76.0592 1.30203C76.1992 1.13928 76.3952 1.03078 76.6472 0.976526C76.8992 0.908711 77.2562 0.874804 77.7181 0.874804V0.447574H72.0485V0.874804C72.5104 0.874804 72.8674 0.908711 73.1194 0.976526C73.3714 1.03078 73.5604 1.13928 73.6864 1.30203C73.8264 1.45123 73.9174 1.67501 73.9594 1.9734C74.0153 2.27178 74.0433 2.69223 74.0433 3.23474V9.84663C74.0433 10.3891 74.0153 10.8096 73.9594 11.108C73.9174 11.4064 73.8264 11.6369 73.6864 11.7997C73.5604 11.9624 73.3714 12.0777 73.1194 12.1455C72.8674 12.1998 72.5104 12.2269 72.0485 12.2269V12.6541H77.7181Z"/>
<path d="M82.5827 12.0438C82.7367 12.0709 82.9887 12.1727 83.3387 12.349C83.7726 12.5389 84.1786 12.6948 84.5566 12.8169C84.9486 12.939 85.3825 13 85.8585 13C86.4045 13 86.9154 12.9118 87.3914 12.7355C87.8814 12.5592 88.3084 12.3151 88.6723 12.0031C89.0363 11.6776 89.3233 11.2911 89.5333 10.8435C89.7433 10.3824 89.8483 9.88054 89.8483 9.33803C89.8483 8.7277 89.6733 8.15128 89.3233 7.60876C88.9733 7.06625 88.4204 6.61189 87.6644 6.2457L85.6485 5.24883C84.6966 4.76056 84.0316 4.3469 83.6536 4.00783C83.2897 3.65519 83.1077 3.22796 83.1077 2.72613C83.1077 2.21075 83.2967 1.78352 83.6746 1.44445C84.0666 1.09181 84.5566 0.915493 85.1445 0.915493C85.7325 0.915493 86.2225 1.01721 86.6145 1.22066C87.0204 1.4241 87.3424 1.70214 87.5804 2.05477C87.8184 2.39384 87.9934 2.76682 88.1054 3.17371C88.2314 3.58059 88.3154 4.01461 88.3574 4.47574H88.7983V0H88.3784C88.2944 0.366197 88.0914 0.678143 87.7694 0.935837C87.3914 0.66458 87.0064 0.461138 86.6145 0.325509C86.2365 0.176317 85.7675 0.101721 85.2075 0.101721C84.1996 0.101721 83.3666 0.393323 82.7087 0.976526C82.0507 1.55973 81.7217 2.27856 81.7217 3.13302C81.7217 3.86541 81.9457 4.52321 82.3937 5.10642C82.8417 5.68962 83.3946 6.15076 84.0526 6.48983L86.0685 7.4867C86.8384 7.88002 87.4334 8.28013 87.8534 8.68701C88.2734 9.08033 88.4834 9.50078 88.4834 9.94836C88.4834 10.5994 88.2314 11.1351 87.7274 11.5556C87.2374 11.976 86.6145 12.1862 85.8585 12.1862C84.9766 12.1862 84.2626 12.0167 83.7166 11.6776C83.1707 11.325 82.7717 10.9249 82.5197 10.4773C82.2817 10.0162 82.1277 9.61607 82.0577 9.277C82.0017 8.92436 81.9737 8.67345 81.9737 8.52426H81.5538V13H81.9737C82.0577 12.6202 82.2607 12.3015 82.5827 12.0438Z"/>
<path d="M105.689 0.447574H100.145V0.874804C100.607 0.874804 100.964 0.908711 101.216 0.976526C101.468 1.03078 101.657 1.13928 101.783 1.30203C101.923 1.45123 102.014 1.67501 102.056 1.9734C102.112 2.27178 102.14 2.69223 102.14 3.23474V9.84663C102.14 10.3891 102.112 10.8096 102.056 11.108C102.014 11.4064 101.923 11.6369 101.783 11.7997C101.657 11.9624 101.468 12.0777 101.216 12.1455C100.964 12.1998 100.607 12.2269 100.145 12.2269V12.6541H105.815V12.2269C105.353 12.2269 104.996 12.1998 104.744 12.1455C104.492 12.0777 104.296 11.9624 104.156 11.7997C104.03 11.6369 103.939 11.4064 103.883 11.108C103.841 10.8096 103.82 10.3891 103.82 9.84663V7.3036H105.689C107.103 7.3036 108.209 6.98487 109.007 6.34742C109.805 5.6964 110.204 4.87585 110.204 3.88576C110.204 2.89567 109.805 2.07512 109.007 1.4241C108.209 0.773083 107.103 0.447574 105.689 0.447574ZM105.668 6.5712H103.82V1.20031H105.668C106.536 1.20031 107.194 1.45123 107.642 1.95305C108.104 2.45488 108.335 3.09911 108.335 3.88576C108.335 4.6724 108.104 5.31664 107.642 5.81847C107.194 6.32029 106.536 6.5712 105.668 6.5712Z"/>
<path d="M128.01 6.55086C128.01 5.68284 127.828 4.8555 127.465 4.06886C127.101 3.28221 126.597 2.59051 125.953 1.99374C125.309 1.39697 124.56 0.935838 123.706 0.610329C122.852 0.271257 121.949 0.101721 120.997 0.101721C120.059 0.101721 119.163 0.271257 118.309 0.610329C117.455 0.935838 116.706 1.39697 116.062 1.99374C115.418 2.59051 114.914 3.28221 114.55 4.06886C114.186 4.8555 114.004 5.68284 114.004 6.55086C114.004 7.41888 114.186 8.24622 114.55 9.03286C114.914 9.81951 115.418 10.5112 116.062 11.108C116.706 11.7047 117.455 12.1727 118.309 12.5117C119.163 12.8372 120.059 13 120.997 13C121.949 13 122.852 12.8372 123.706 12.5117C124.56 12.1727 125.309 11.7047 125.953 11.108C126.597 10.5112 127.101 9.81951 127.465 9.03286C127.828 8.24622 128.01 7.41888 128.01 6.55086ZM120.997 0.895149C121.865 0.895149 122.621 1.06468 123.265 1.40376C123.909 1.72926 124.434 2.17006 124.84 2.72613C125.246 3.28221 125.54 3.89254 125.722 4.55712C125.918 5.2217 126.016 5.88628 126.016 6.55086C126.016 7.21544 125.918 7.88002 125.722 8.5446C125.54 9.19562 125.246 9.79917 124.84 10.3552C124.434 10.9113 123.909 11.3589 123.265 11.698C122.621 12.0235 121.865 12.1862 120.997 12.1862C120.129 12.1862 119.373 12.0235 118.729 11.698C118.099 11.3589 117.581 10.9113 117.175 10.3552C116.769 9.79917 116.468 9.19562 116.272 8.5446C116.09 7.88002 115.999 7.21544 115.999 6.55086C115.999 5.88628 116.09 5.2217 116.272 4.55712C116.468 3.89254 116.769 3.28221 117.175 2.72613C117.581 2.17006 118.099 1.72926 118.729 1.40376C119.373 1.06468 120.129 0.895149 120.997 0.895149Z"/>
<path d="M132.096 12.6541H142.386L142.554 9.94836H142.113L142.008 10.3552C141.854 10.952 141.63 11.3589 141.336 11.5759C141.056 11.7929 140.468 11.9014 139.572 11.9014H137.766C137.304 11.9014 136.947 11.8743 136.695 11.82C136.443 11.7522 136.247 11.6437 136.107 11.4945C135.981 11.3318 135.89 11.1012 135.834 10.8028C135.792 10.4909 135.771 10.0704 135.771 9.54147V6.5712H136.821C137.381 6.5712 137.815 6.59833 138.123 6.65258C138.431 6.69327 138.662 6.78143 138.816 6.91706C138.984 7.03912 139.096 7.229 139.152 7.4867C139.222 7.73083 139.257 8.07668 139.257 8.52426H139.698V3.86541H139.257C139.257 4.31299 139.222 4.66562 139.152 4.92332C139.096 5.16745 138.984 5.35733 138.816 5.49296C138.662 5.61502 138.431 5.70318 138.123 5.75743C137.815 5.79812 137.381 5.81847 136.821 5.81847H135.771V1.20031H138.879C139.775 1.20031 140.363 1.30882 140.643 1.52582C140.923 1.72926 141.147 2.12937 141.315 2.72613L141.42 3.13302H141.861L141.672 0.447574H132.096V0.874804C132.558 0.874804 132.915 0.908711 133.167 0.976526C133.419 1.03078 133.608 1.13928 133.734 1.30203C133.874 1.45123 133.965 1.67501 134.007 1.9734C134.063 2.27178 134.091 2.69223 134.091 3.23474V9.84663C134.091 10.3891 134.063 10.8096 134.007 11.108C133.965 11.4064 133.874 11.6369 133.734 11.7997C133.608 11.9624 133.419 12.0777 133.167 12.1455C132.915 12.1998 132.558 12.2269 132.096 12.2269V12.6541Z"/>
<path d="M158.47 0.447574H145.724L145.535 3.19405H145.976L146.081 2.78717C146.249 2.17684 146.473 1.76995 146.753 1.56651C147.033 1.3495 147.621 1.241 148.517 1.241H151.267V9.84663C151.267 10.3756 151.239 10.796 151.183 11.108C151.141 11.4064 151.05 11.6369 150.91 11.7997C150.77 11.9624 150.574 12.0777 150.322 12.1455C150.07 12.1998 149.714 12.2269 149.252 12.2269V12.6541H154.942V12.2269C154.48 12.2269 154.123 12.1998 153.871 12.1455C153.619 12.0777 153.423 11.9624 153.283 11.7997C153.143 11.6369 153.045 11.4064 152.989 11.108C152.947 10.796 152.926 10.3756 152.926 9.84663V1.241H155.677C156.573 1.241 157.161 1.3495 157.441 1.56651C157.721 1.76995 157.945 2.17684 158.113 2.78717L158.218 3.19405H158.659L158.47 0.447574Z"/>
<path d="M166.966 6.5712H165.118V1.20031H166.966C167.834 1.20031 168.492 1.45123 168.94 1.95305C169.402 2.45488 169.633 3.09911 169.633 3.88576C169.633 4.6724 169.402 5.31664 168.94 5.81847C168.492 6.32029 167.834 6.5712 166.966 6.5712ZM167.764 7.3036C168.926 7.18153 169.836 6.80856 170.494 6.18466C171.165 5.56077 171.501 4.79447 171.501 3.88576C171.501 2.89567 171.102 2.07512 170.305 1.4241C169.507 0.773083 168.401 0.447574 166.987 0.447574H161.443V0.874804C161.905 0.874804 162.262 0.908711 162.514 0.976526C162.766 1.03078 162.955 1.13928 163.081 1.30203C163.221 1.45123 163.312 1.67501 163.354 1.9734C163.41 2.27178 163.438 2.69223 163.438 3.23474V9.84663C163.438 10.3891 163.41 10.8096 163.354 11.108C163.312 11.4064 163.221 11.6369 163.081 11.7997C162.955 11.9624 162.766 12.0777 162.514 12.1455C162.262 12.1998 161.905 12.2269 161.443 12.2269V12.6541H167.113V12.2269C166.651 12.2269 166.294 12.1998 166.042 12.1455C165.79 12.0777 165.594 11.9624 165.454 11.7997C165.328 11.6369 165.237 11.4064 165.181 11.108C165.139 10.8096 165.118 10.3891 165.118 9.84663V7.3036H166.105L170.263 12.6541H173.727V12.2269C173.111 12.1591 172.467 11.8946 171.795 11.4335C171.123 10.9724 170.466 10.3756 169.822 9.64319L167.764 7.3036Z"/>
<path d="M181.49 7.73083L184.955 2.64476C185.431 1.95305 185.851 1.48513 186.215 1.241C186.593 0.99687 187.188 0.874804 188 0.874804V0.447574H183.086V0.874804C184.122 0.874804 184.64 1.07147 184.64 1.46479C184.64 1.68179 184.5 2.00052 184.22 2.42097L181.154 6.89671L178.131 2.42097C177.879 2.04121 177.753 1.74283 177.753 1.52582C177.753 1.30882 177.872 1.14606 178.11 1.03756C178.348 0.929055 178.733 0.874804 179.265 0.874804V0.447574H173.28V0.874804C174.008 0.874804 174.582 1.00365 175.002 1.26135C175.422 1.50548 175.863 1.96661 176.325 2.64476L179.81 7.87324V9.84663C179.81 10.3891 179.782 10.8096 179.726 11.108C179.684 11.4064 179.593 11.6369 179.453 11.7997C179.327 11.9624 179.139 12.0777 178.887 12.1455C178.635 12.1998 178.278 12.2269 177.816 12.2269V12.6541H183.485V12.2269C183.023 12.2269 182.666 12.1998 182.414 12.1455C182.162 12.0777 181.966 11.9624 181.826 11.7997C181.7 11.6369 181.609 11.4064 181.553 11.108C181.511 10.8096 181.49 10.3891 181.49 9.84663V7.73083Z"/>
</g>
</svg>
	</div>

</footer>
</div>
</div>
<script type="speculationrules">
{"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/files/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/wporg-developer-2023/*","/wp-content/themes/wporg-parent-2021/*","/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]}
</script>
<script data-wp-router-options="{&quot;loadOnClientNavigation&quot;:true}" fetchpriority="low" id="@wordpress/block-library/navigation/view-js-module" src="https://developer.wordpress.org/wp-content/plugins/gutenberg/build/modules/block-library/navigation/view.min.js?ver=5381c0a3642be76565c7-20240308" type="module"></script>
<script id="wp-script-module-data-@wordpress/interactivity" type="application/json">
{"state":{"jetpack-search":{"siteId":209306761,"apiRoot":"https://developer.wordpress.org/wp-json/","nonce":"fe2b0e9b74","isPrivateSite":false,"isWpcom":false,"isPhotonEnabled":true,"disableTracking":false,"isWooCommerceBlocksEnabled":false,"homeUrl":"https://developer.wordpress.org","locale":"en-US","dateFormat":"F j, Y","searchQuery":"","hasSearchParam":false,"searchParamName":"q","sortOrder":"relevance","activeFilters":[],"filterLogic":[],"priceRange":null,"staticFilterSelections":{},"filterConfigs":[],"results":[],"aggregations":{},"retainedFilterOptions":{},"totalResults":0,"pageHandle":null,"isLoading":false,"isLoadingMore":false,"hasError":false,"resultsCountText":"","strings":{"searching":"Searching…","resultsCountSingle":"Found %d result","resultsCountPlural":"Found %d results","removeFilter":"Remove %s","ratingStarsTop":"5 stars","ratingStarsAndUpSingle":"%d star and up","ratingStarsAndUpPlural":"%d stars and up","priceRangeFromTo":"%1$s – %2$s","priceRangeFrom":"%s+","priceRangeUpTo":"Under %s","priceLabel":"Price","suggestionLabelQuery":"Suggestions","suggestionLabelTaxonomy":"Popular Filters","suggestionLabelPost":"Articles","aiErrorMessage":"Sorry, an error occurred while generating an answer.","aiErrorCode":"Error code: %s"},"priceCurrencySymbol":"$","aiExtendedLoadingHints":["Searching harder","Looking deeper into this","Finding a more complete answer","Analyzing additional sources","Gathering more details","Pulling in more context","Expanding the search","Rolling up my virtual sleeves","Digging through the archives","Putting on my reading glasses","Checking under the digital couch cushions","Consulting the oracle","Asking a smarter algorithm","Brewing a fresh batch of insights","Unleashing the full power of search"],"wcStockStatusLabels":{"instock":"In stock"},"highlightPhraseOnly":false,"highlightFilterStopwords":[],"highlightFields":null,"additionalBlogIds":[],"adminQueryFilter":null,"customResults":[]}}}
</script>
<script id="mkaz-code-syntax-prism-js-js-extra">
var prism_settings = {"pluginUrl":"https://developer.wordpress.org/wp-content/plugins/code-syntax-block/"};
//# sourceURL=mkaz-code-syntax-prism-js-js-extra
</script>
<script id="mkaz-code-syntax-prism-js-js" src="https://developer.wordpress.org/wp-content/plugins/code-syntax-block/assets/prism/prism.js?ver=1781196566"></script>
<script data-wp-strategy="defer" defer id="wporg-time-view-script-js" src="https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/time/build/view.js?ver=385bfe9134bf98c52dda"></script>
<script id="awesomplete-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/awesomplete.min.js?ver=1781196441"></script>
<script id="autocomplete-js-extra">
var autocomplete = {"ajaxurl":"https://developer.wordpress.org/wp-admin/admin-ajax.php","nonce":"95c8542c31","post_type":"wp-parser-class"};
//# sourceURL=autocomplete-js-extra
</script>
<script id="autocomplete-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/autocomplete.js?ver=1781196441"></script>
<script id="wp-dom-ready-js" src="https://developer.wordpress.org/wp-content/plugins/gutenberg/build/scripts/dom-ready/index.min.js?ver=3fe927cab37bf38d6a23"></script>
<script id="wp-hooks-js" src="https://developer.wordpress.org/wp-content/plugins/gutenberg/build/scripts/hooks/index.min.js?ver=f0f188028580e8dc1255"></script>
<script id="wp-i18n-js" src="https://developer.wordpress.org/wp-content/plugins/gutenberg/build/scripts/i18n/index.min.js?ver=1dfe7db3940c23ea9216"></script>
<script id="wp-i18n-js-after">
wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );
//# sourceURL=wp-i18n-js-after
</script>
<script id="wp-a11y-js" src="https://developer.wordpress.org/wp-content/plugins/gutenberg/build/scripts/a11y/index.min.js?ver=31c6cec5a4ff7aff483d"></script>
<script id="wporg-developer-function-reference-js-extra">
var wporgFunctionReferenceI18n = {"copy":"Copy","copied":"Code copied","expand":"Expand code","collapse":"Collapse code","sourceFile":"wp-includes/class-wp-query.php"};
//# sourceURL=wporg-developer-function-reference-js-extra
</script>
<script id="wporg-developer-function-reference-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/function-reference.js?ver=1781196441"></script>
<script id="quicktags-js-extra">
var quicktagsL10n = {"closeAllOpenTags":"Close all open tags","closeTags":"close tags","enterURL":"Enter the URL","enterImageURL":"Enter the URL of the image","enterImageDescription":"Enter a description of the image","textdirection":"text direction","toggleTextdirection":"Switch Editor Text Direction","dfw":"Distraction-free writing mode","strong":"Bold","strongClose":"Close bold tag","em":"Italic","emClose":"Close italic tag","link":"Insert link","blockquote":"Blockquote","blockquoteClose":"Close blockquote tag","del":"Deleted text (strikethrough)","delClose":"Close deleted text tag","ins":"Inserted text","insClose":"Close inserted text tag","image":"Insert image","ul":"Bulleted list","ulClose":"Close bulleted list tag","ol":"Numbered list","olClose":"Close numbered list tag","li":"List item","liClose":"Close list item tag","code":"Code","codeClose":"Close code tag","more":"Insert Read More tag"};
//# sourceURL=quicktags-js-extra
</script>
<script id="quicktags-js" src="https://developer.wordpress.org/wp-includes/js/quicktags.min.js?ver=7.2-alpha-64251"></script>
<script id="wporg-developer-user-notes-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/user-notes.js?ver=1781196441"></script>
<script id="wporg-developer-user-notes-feedback-js-extra">
var wporg_note_feedback = {"show":"Show feedback","hide":"Hide feedback","hide_feedback":"Hide feedback form","add_feedback":"Add feedback"};
//# sourceURL=wporg-developer-user-notes-feedback-js-extra
</script>
<script id="wporg-developer-user-notes-feedback-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/user-notes-feedback.js?ver=1781196441"></script>
<script id="wporg-developer-tabs-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/tabs.js?ver=1781196441"></script>
<script id="wporg-developer-preview-js-extra">
var wporg_note_preview = {"ajaxurl":"https://developer.wordpress.org/wp-admin/admin-ajax.php","nonce":"d7b29b5cdf","preview":"preview note","preview_empty":"Nothing to preview","is_admin":""};
//# sourceURL=wporg-developer-preview-js-extra
</script>
<script id="wporg-developer-preview-js" src="https://developer.wordpress.org/wp-content/themes/wporg-developer-2023/js/user-notes-preview.js?ver=1781196441"></script>
<script id="jetpack-stats-js-before">
_stq = window._stq || [];
_stq.push([ "view", {"v":"ext","blog":"209306761","post":"2839","tz":"0","srv":"developer.wordpress.org","j":"1:16.3"} ]);
_stq.push([ "clickTrackerInit", "209306761", "2839" ]);
//# sourceURL=jetpack-stats-js-before
</script>
<script data-wp-strategy="defer" defer fetchpriority="low" id="jetpack-stats-js" src="https://stats.wp.com/e-202641.js"></script>
<script id="wporg-global-header-script-js-extra">
var wporgGlobalHeaderI18n = {"openSearchLabel":"Open Search","closeSearchLabel":"Close Search","overflowMenuLabel":"More menu"};
//# sourceURL=wporg-global-header-script-js-extra
</script>
<script id="wporg-global-header-script-js" src="https://developer.wordpress.org/wp-content/mu-plugins/pub-sync/blocks/global-header-footer/js/view.js?ver=1781196414"></script>
<script id="wp-emoji-settings" type="application/json">
{"baseUrl":"https://s.w.org/images/core/emoji/17.0.2/72x72/","ext":".png","svgUrl":"https://s.w.org/images/core/emoji/17.0.2/svg/","svgExt":".svg","source":{"concatemoji":"https://developer.wordpress.org/wp-includes/js/wp-emoji-release.min.js?ver=7.2-alpha-64251"}}
</script>
<script type="module">
/*! This file is auto-generated */
var e="script#wp-emoji-settings",t=document.querySelector(e);if(!(t instanceof HTMLScriptElement))throw new Error("Element missing: "+e);const o=JSON.parse(t.text),s=(window._wpemojiSettings=o,"wpEmojiSettingsSupports"),i=["flag","emoji"];function c(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(s,JSON.stringify(t))}catch(e){}}function p(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data);e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0);const r=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data);return t.every((e,t)=>e===r[t])}function f(e,t){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var n=e.getImageData(16,16,1,1);for(let e=0;e<n.data.length;e++)if(0!==n.data[e])return!1;return!0}function u(e,t,n,r){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\udde8\ud83c\uddf6","\ud83c\udde8\u200b\ud83c\uddf6")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!r(e,"\ud83e\udec8")}}function l(e,t,n,r){let a;if(!(a=("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):document.createElement("canvas")).getContext("2d",{willReadFrequently:!0})))throw new Error("Unable to obtain a 2D context for the emoji support tests.");a.textBaseline="top",a.font="600 32px Arial";const o={};return e.forEach(e=>{o[e]=t(a,e,n,r)}),o}function g(e){var t=document.createElement("script");t.src=e,t.defer=!0,document.head.appendChild(t)}o.supports={everything:!0,everythingExceptFlag:!0},new Promise(t=>{var e=function(){try{var e=sessionStorage.getItem(s);if(null===e)return null;var t=JSON.parse(e);if("object"==typeof t&&"number"==typeof t.timestamp&&(new Date).valueOf()<t.timestamp+604800&&"object"==typeof t.supportTests)return t.supportTests}catch(e){}return null}();if(e)t(e);else{if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&"function"==typeof URL.createObjectURL&&"undefined"!=typeof Blob)try{var n="postMessage("+l.toString()+"("+[JSON.stringify(i),u.toString(),p.toString(),f.toString()].join(",")+"));",r=new Blob([n],{type:"text/javascript"});const a=new Worker(URL.createObjectURL(r),{name:"wpTestEmojiSupports"});return void(a.onmessage=e=>{c(e.data),a.terminate(),t(e.data)})}catch(e){}e=l(i,u,p,f);c(e),t(e)}}).then(e=>{for(const a in e){var t=a,n=e[t];o.supports[t]=n,o.supports.everything=o.supports.everything&&n,"flag"!==t&&(o.supports.everythingExceptFlag=o.supports.everythingExceptFlag&&n)}var r;o.supports.everythingExceptFlag=o.supports.everythingExceptFlag&&!o.supports.flag,o.supports.everything||((r=o.source||{}).concatemoji?g(r.concatemoji):r.wpemoji&&r.twemoji&&(g(r.twemoji),g(r.wpemoji)))});
//# sourceURL=https://developer.wordpress.org/wp-includes/js/wp-emoji-loader.min.js
</script>
</body>
</html>
