Edit File by line
/home/barbar84/www/wp-inclu...
File: class-wp-query.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Query API: WP_Query class
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Query
[5] Fix | Delete
* @since 4.7.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* The WordPress Query class.
[10] Fix | Delete
*
[11] Fix | Delete
* @link https://developer.wordpress.org/reference/classes/wp_query/
[12] Fix | Delete
*
[13] Fix | Delete
* @since 1.5.0
[14] Fix | Delete
* @since 4.5.0 Removed the `$comments_popup` property.
[15] Fix | Delete
*/
[16] Fix | Delete
class WP_Query {
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Query vars set by the user
[20] Fix | Delete
*
[21] Fix | Delete
* @since 1.5.0
[22] Fix | Delete
* @var array
[23] Fix | Delete
*/
[24] Fix | Delete
public $query;
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* Query vars, after parsing
[28] Fix | Delete
*
[29] Fix | Delete
* @since 1.5.0
[30] Fix | Delete
* @var array
[31] Fix | Delete
*/
[32] Fix | Delete
public $query_vars = array();
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Taxonomy query, as passed to get_tax_sql()
[36] Fix | Delete
*
[37] Fix | Delete
* @since 3.1.0
[38] Fix | Delete
* @var WP_Tax_Query A taxonomy query instance.
[39] Fix | Delete
*/
[40] Fix | Delete
public $tax_query;
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Metadata query container
[44] Fix | Delete
*
[45] Fix | Delete
* @since 3.2.0
[46] Fix | Delete
* @var WP_Meta_Query A meta query instance.
[47] Fix | Delete
*/
[48] Fix | Delete
public $meta_query = false;
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Date query container
[52] Fix | Delete
*
[53] Fix | Delete
* @since 3.7.0
[54] Fix | Delete
* @var WP_Date_Query A date query instance.
[55] Fix | Delete
*/
[56] Fix | Delete
public $date_query = false;
[57] Fix | Delete
[58] Fix | Delete
/**
[59] Fix | Delete
* Holds the data for a single object that is queried.
[60] Fix | Delete
*
[61] Fix | Delete
* Holds the contents of a post, page, category, attachment.
[62] Fix | Delete
*
[63] Fix | Delete
* @since 1.5.0
[64] Fix | Delete
* @var WP_Term|WP_Post_Type|WP_Post|WP_User|null
[65] Fix | Delete
*/
[66] Fix | Delete
public $queried_object;
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* The ID of the queried object.
[70] Fix | Delete
*
[71] Fix | Delete
* @since 1.5.0
[72] Fix | Delete
* @var int
[73] Fix | Delete
*/
[74] Fix | Delete
public $queried_object_id;
[75] Fix | Delete
[76] Fix | Delete
/**
[77] Fix | Delete
* SQL for the database query.
[78] Fix | Delete
*
[79] Fix | Delete
* @since 2.0.1
[80] Fix | Delete
* @var string
[81] Fix | Delete
*/
[82] Fix | Delete
public $request;
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Array of post objects or post IDs.
[86] Fix | Delete
*
[87] Fix | Delete
* @since 1.5.0
[88] Fix | Delete
* @var WP_Post[]|int[]
[89] Fix | Delete
*/
[90] Fix | Delete
public $posts;
[91] Fix | Delete
[92] Fix | Delete
/**
[93] Fix | Delete
* The amount of posts for the current query.
[94] Fix | Delete
*
[95] Fix | Delete
* @since 1.5.0
[96] Fix | Delete
* @var int
[97] Fix | Delete
*/
[98] Fix | Delete
public $post_count = 0;
[99] Fix | Delete
[100] Fix | Delete
/**
[101] Fix | Delete
* Index of the current item in the loop.
[102] Fix | Delete
*
[103] Fix | Delete
* @since 1.5.0
[104] Fix | Delete
* @var int
[105] Fix | Delete
*/
[106] Fix | Delete
public $current_post = -1;
[107] Fix | Delete
[108] Fix | Delete
/**
[109] Fix | Delete
* Whether the loop has started and the caller is in the loop.
[110] Fix | Delete
*
[111] Fix | Delete
* @since 2.0.0
[112] Fix | Delete
* @var bool
[113] Fix | Delete
*/
[114] Fix | Delete
public $in_the_loop = false;
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* The current post.
[118] Fix | Delete
*
[119] Fix | Delete
* This property does not get populated when the `fields` argument is set to
[120] Fix | Delete
* `ids` or `id=>parent`.
[121] Fix | Delete
*
[122] Fix | Delete
* @since 1.5.0
[123] Fix | Delete
* @var WP_Post|null
[124] Fix | Delete
*/
[125] Fix | Delete
public $post;
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* The list of comments for current post.
[129] Fix | Delete
*
[130] Fix | Delete
* @since 2.2.0
[131] Fix | Delete
* @var WP_Comment[]
[132] Fix | Delete
*/
[133] Fix | Delete
public $comments;
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* The amount of comments for the posts.
[137] Fix | Delete
*
[138] Fix | Delete
* @since 2.2.0
[139] Fix | Delete
* @var int
[140] Fix | Delete
*/
[141] Fix | Delete
public $comment_count = 0;
[142] Fix | Delete
[143] Fix | Delete
/**
[144] Fix | Delete
* The index of the comment in the comment loop.
[145] Fix | Delete
*
[146] Fix | Delete
* @since 2.2.0
[147] Fix | Delete
* @var int
[148] Fix | Delete
*/
[149] Fix | Delete
public $current_comment = -1;
[150] Fix | Delete
[151] Fix | Delete
/**
[152] Fix | Delete
* Current comment object.
[153] Fix | Delete
*
[154] Fix | Delete
* @since 2.2.0
[155] Fix | Delete
* @var WP_Comment
[156] Fix | Delete
*/
[157] Fix | Delete
public $comment;
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* The amount of found posts for the current query.
[161] Fix | Delete
*
[162] Fix | Delete
* If limit clause was not used, equals $post_count.
[163] Fix | Delete
*
[164] Fix | Delete
* @since 2.1.0
[165] Fix | Delete
* @var int
[166] Fix | Delete
*/
[167] Fix | Delete
public $found_posts = 0;
[168] Fix | Delete
[169] Fix | Delete
/**
[170] Fix | Delete
* The amount of pages.
[171] Fix | Delete
*
[172] Fix | Delete
* @since 2.1.0
[173] Fix | Delete
* @var int
[174] Fix | Delete
*/
[175] Fix | Delete
public $max_num_pages = 0;
[176] Fix | Delete
[177] Fix | Delete
/**
[178] Fix | Delete
* The amount of comment pages.
[179] Fix | Delete
*
[180] Fix | Delete
* @since 2.7.0
[181] Fix | Delete
* @var int
[182] Fix | Delete
*/
[183] Fix | Delete
public $max_num_comment_pages = 0;
[184] Fix | Delete
[185] Fix | Delete
/**
[186] Fix | Delete
* Signifies whether the current query is for a single post.
[187] Fix | Delete
*
[188] Fix | Delete
* @since 1.5.0
[189] Fix | Delete
* @var bool
[190] Fix | Delete
*/
[191] Fix | Delete
public $is_single = false;
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Signifies whether the current query is for a preview.
[195] Fix | Delete
*
[196] Fix | Delete
* @since 2.0.0
[197] Fix | Delete
* @var bool
[198] Fix | Delete
*/
[199] Fix | Delete
public $is_preview = false;
[200] Fix | Delete
[201] Fix | Delete
/**
[202] Fix | Delete
* Signifies whether the current query is for a page.
[203] Fix | Delete
*
[204] Fix | Delete
* @since 1.5.0
[205] Fix | Delete
* @var bool
[206] Fix | Delete
*/
[207] Fix | Delete
public $is_page = false;
[208] Fix | Delete
[209] Fix | Delete
/**
[210] Fix | Delete
* Signifies whether the current query is for an archive.
[211] Fix | Delete
*
[212] Fix | Delete
* @since 1.5.0
[213] Fix | Delete
* @var bool
[214] Fix | Delete
*/
[215] Fix | Delete
public $is_archive = false;
[216] Fix | Delete
[217] Fix | Delete
/**
[218] Fix | Delete
* Signifies whether the current query is for a date archive.
[219] Fix | Delete
*
[220] Fix | Delete
* @since 1.5.0
[221] Fix | Delete
* @var bool
[222] Fix | Delete
*/
[223] Fix | Delete
public $is_date = false;
[224] Fix | Delete
[225] Fix | Delete
/**
[226] Fix | Delete
* Signifies whether the current query is for a year archive.
[227] Fix | Delete
*
[228] Fix | Delete
* @since 1.5.0
[229] Fix | Delete
* @var bool
[230] Fix | Delete
*/
[231] Fix | Delete
public $is_year = false;
[232] Fix | Delete
[233] Fix | Delete
/**
[234] Fix | Delete
* Signifies whether the current query is for a month archive.
[235] Fix | Delete
*
[236] Fix | Delete
* @since 1.5.0
[237] Fix | Delete
* @var bool
[238] Fix | Delete
*/
[239] Fix | Delete
public $is_month = false;
[240] Fix | Delete
[241] Fix | Delete
/**
[242] Fix | Delete
* Signifies whether the current query is for a day archive.
[243] Fix | Delete
*
[244] Fix | Delete
* @since 1.5.0
[245] Fix | Delete
* @var bool
[246] Fix | Delete
*/
[247] Fix | Delete
public $is_day = false;
[248] Fix | Delete
[249] Fix | Delete
/**
[250] Fix | Delete
* Signifies whether the current query is for a specific time.
[251] Fix | Delete
*
[252] Fix | Delete
* @since 1.5.0
[253] Fix | Delete
* @var bool
[254] Fix | Delete
*/
[255] Fix | Delete
public $is_time = false;
[256] Fix | Delete
[257] Fix | Delete
/**
[258] Fix | Delete
* Signifies whether the current query is for an author archive.
[259] Fix | Delete
*
[260] Fix | Delete
* @since 1.5.0
[261] Fix | Delete
* @var bool
[262] Fix | Delete
*/
[263] Fix | Delete
public $is_author = false;
[264] Fix | Delete
[265] Fix | Delete
/**
[266] Fix | Delete
* Signifies whether the current query is for a category archive.
[267] Fix | Delete
*
[268] Fix | Delete
* @since 1.5.0
[269] Fix | Delete
* @var bool
[270] Fix | Delete
*/
[271] Fix | Delete
public $is_category = false;
[272] Fix | Delete
[273] Fix | Delete
/**
[274] Fix | Delete
* Signifies whether the current query is for a tag archive.
[275] Fix | Delete
*
[276] Fix | Delete
* @since 2.3.0
[277] Fix | Delete
* @var bool
[278] Fix | Delete
*/
[279] Fix | Delete
public $is_tag = false;
[280] Fix | Delete
[281] Fix | Delete
/**
[282] Fix | Delete
* Signifies whether the current query is for a taxonomy archive.
[283] Fix | Delete
*
[284] Fix | Delete
* @since 2.5.0
[285] Fix | Delete
* @var bool
[286] Fix | Delete
*/
[287] Fix | Delete
public $is_tax = false;
[288] Fix | Delete
[289] Fix | Delete
/**
[290] Fix | Delete
* Signifies whether the current query is for a search.
[291] Fix | Delete
*
[292] Fix | Delete
* @since 1.5.0
[293] Fix | Delete
* @var bool
[294] Fix | Delete
*/
[295] Fix | Delete
public $is_search = false;
[296] Fix | Delete
[297] Fix | Delete
/**
[298] Fix | Delete
* Signifies whether the current query is for a feed.
[299] Fix | Delete
*
[300] Fix | Delete
* @since 1.5.0
[301] Fix | Delete
* @var bool
[302] Fix | Delete
*/
[303] Fix | Delete
public $is_feed = false;
[304] Fix | Delete
[305] Fix | Delete
/**
[306] Fix | Delete
* Signifies whether the current query is for a comment feed.
[307] Fix | Delete
*
[308] Fix | Delete
* @since 2.2.0
[309] Fix | Delete
* @var bool
[310] Fix | Delete
*/
[311] Fix | Delete
public $is_comment_feed = false;
[312] Fix | Delete
[313] Fix | Delete
/**
[314] Fix | Delete
* Signifies whether the current query is for trackback endpoint call.
[315] Fix | Delete
*
[316] Fix | Delete
* @since 1.5.0
[317] Fix | Delete
* @var bool
[318] Fix | Delete
*/
[319] Fix | Delete
public $is_trackback = false;
[320] Fix | Delete
[321] Fix | Delete
/**
[322] Fix | Delete
* Signifies whether the current query is for the site homepage.
[323] Fix | Delete
*
[324] Fix | Delete
* @since 1.5.0
[325] Fix | Delete
* @var bool
[326] Fix | Delete
*/
[327] Fix | Delete
public $is_home = false;
[328] Fix | Delete
[329] Fix | Delete
/**
[330] Fix | Delete
* Signifies whether the current query is for the Privacy Policy page.
[331] Fix | Delete
*
[332] Fix | Delete
* @since 5.2.0
[333] Fix | Delete
* @var bool
[334] Fix | Delete
*/
[335] Fix | Delete
public $is_privacy_policy = false;
[336] Fix | Delete
[337] Fix | Delete
/**
[338] Fix | Delete
* Signifies whether the current query couldn't find anything.
[339] Fix | Delete
*
[340] Fix | Delete
* @since 1.5.0
[341] Fix | Delete
* @var bool
[342] Fix | Delete
*/
[343] Fix | Delete
public $is_404 = false;
[344] Fix | Delete
[345] Fix | Delete
/**
[346] Fix | Delete
* Signifies whether the current query is for an embed.
[347] Fix | Delete
*
[348] Fix | Delete
* @since 4.4.0
[349] Fix | Delete
* @var bool
[350] Fix | Delete
*/
[351] Fix | Delete
public $is_embed = false;
[352] Fix | Delete
[353] Fix | Delete
/**
[354] Fix | Delete
* Signifies whether the current query is for a paged result and not for the first page.
[355] Fix | Delete
*
[356] Fix | Delete
* @since 1.5.0
[357] Fix | Delete
* @var bool
[358] Fix | Delete
*/
[359] Fix | Delete
public $is_paged = false;
[360] Fix | Delete
[361] Fix | Delete
/**
[362] Fix | Delete
* Signifies whether the current query is for an administrative interface page.
[363] Fix | Delete
*
[364] Fix | Delete
* @since 1.5.0
[365] Fix | Delete
* @var bool
[366] Fix | Delete
*/
[367] Fix | Delete
public $is_admin = false;
[368] Fix | Delete
[369] Fix | Delete
/**
[370] Fix | Delete
* Signifies whether the current query is for an attachment page.
[371] Fix | Delete
*
[372] Fix | Delete
* @since 2.0.0
[373] Fix | Delete
* @var bool
[374] Fix | Delete
*/
[375] Fix | Delete
public $is_attachment = false;
[376] Fix | Delete
[377] Fix | Delete
/**
[378] Fix | Delete
* Signifies whether the current query is for an existing single post of any post type
[379] Fix | Delete
* (post, attachment, page, custom post types).
[380] Fix | Delete
*
[381] Fix | Delete
* @since 2.1.0
[382] Fix | Delete
* @var bool
[383] Fix | Delete
*/
[384] Fix | Delete
public $is_singular = false;
[385] Fix | Delete
[386] Fix | Delete
/**
[387] Fix | Delete
* Signifies whether the current query is for the robots.txt file.
[388] Fix | Delete
*
[389] Fix | Delete
* @since 2.1.0
[390] Fix | Delete
* @var bool
[391] Fix | Delete
*/
[392] Fix | Delete
public $is_robots = false;
[393] Fix | Delete
[394] Fix | Delete
/**
[395] Fix | Delete
* Signifies whether the current query is for the favicon.ico file.
[396] Fix | Delete
*
[397] Fix | Delete
* @since 5.4.0
[398] Fix | Delete
* @var bool
[399] Fix | Delete
*/
[400] Fix | Delete
public $is_favicon = false;
[401] Fix | Delete
[402] Fix | Delete
/**
[403] Fix | Delete
* Signifies whether the current query is for the page_for_posts page.
[404] Fix | Delete
*
[405] Fix | Delete
* Basically, the homepage if the option isn't set for the static homepage.
[406] Fix | Delete
*
[407] Fix | Delete
* @since 2.1.0
[408] Fix | Delete
* @var bool
[409] Fix | Delete
*/
[410] Fix | Delete
public $is_posts_page = false;
[411] Fix | Delete
[412] Fix | Delete
/**
[413] Fix | Delete
* Signifies whether the current query is for a post type archive.
[414] Fix | Delete
*
[415] Fix | Delete
* @since 3.1.0
[416] Fix | Delete
* @var bool
[417] Fix | Delete
*/
[418] Fix | Delete
public $is_post_type_archive = false;
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
* Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know
[422] Fix | Delete
* whether we have to re-parse because something has changed
[423] Fix | Delete
*
[424] Fix | Delete
* @since 3.1.0
[425] Fix | Delete
* @var bool|string
[426] Fix | Delete
*/
[427] Fix | Delete
private $query_vars_hash = false;
[428] Fix | Delete
[429] Fix | Delete
/**
[430] Fix | Delete
* Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made
[431] Fix | Delete
* via pre_get_posts hooks.
[432] Fix | Delete
*
[433] Fix | Delete
* @since 3.1.1
[434] Fix | Delete
*/
[435] Fix | Delete
private $query_vars_changed = true;
[436] Fix | Delete
[437] Fix | Delete
/**
[438] Fix | Delete
* Set if post thumbnails are cached
[439] Fix | Delete
*
[440] Fix | Delete
* @since 3.2.0
[441] Fix | Delete
* @var bool
[442] Fix | Delete
*/
[443] Fix | Delete
public $thumbnails_cached = false;
[444] Fix | Delete
[445] Fix | Delete
/**
[446] Fix | Delete
* Controls whether an attachment query should include filenames or not.
[447] Fix | Delete
*
[448] Fix | Delete
* @since 6.0.3
[449] Fix | Delete
* @var bool
[450] Fix | Delete
*/
[451] Fix | Delete
protected $allow_query_attachment_by_filename = false;
[452] Fix | Delete
/**
[453] Fix | Delete
* Cached list of search stopwords.
[454] Fix | Delete
*
[455] Fix | Delete
* @since 3.7.0
[456] Fix | Delete
* @var array
[457] Fix | Delete
*/
[458] Fix | Delete
private $stopwords;
[459] Fix | Delete
[460] Fix | Delete
private $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );
[461] Fix | Delete
[462] Fix | Delete
private $compat_methods = array( 'init_query_flags', 'parse_tax_query' );
[463] Fix | Delete
[464] Fix | Delete
/**
[465] Fix | Delete
* Resets query flags to false.
[466] Fix | Delete
*
[467] Fix | Delete
* The query flags are what page info WordPress was able to figure out.
[468] Fix | Delete
*
[469] Fix | Delete
* @since 2.0.0
[470] Fix | Delete
*/
[471] Fix | Delete
private function init_query_flags() {
[472] Fix | Delete
$this->is_single = false;
[473] Fix | Delete
$this->is_preview = false;
[474] Fix | Delete
$this->is_page = false;
[475] Fix | Delete
$this->is_archive = false;
[476] Fix | Delete
$this->is_date = false;
[477] Fix | Delete
$this->is_year = false;
[478] Fix | Delete
$this->is_month = false;
[479] Fix | Delete
$this->is_day = false;
[480] Fix | Delete
$this->is_time = false;
[481] Fix | Delete
$this->is_author = false;
[482] Fix | Delete
$this->is_category = false;
[483] Fix | Delete
$this->is_tag = false;
[484] Fix | Delete
$this->is_tax = false;
[485] Fix | Delete
$this->is_search = false;
[486] Fix | Delete
$this->is_feed = false;
[487] Fix | Delete
$this->is_comment_feed = false;
[488] Fix | Delete
$this->is_trackback = false;
[489] Fix | Delete
$this->is_home = false;
[490] Fix | Delete
$this->is_privacy_policy = false;
[491] Fix | Delete
$this->is_404 = false;
[492] Fix | Delete
$this->is_paged = false;
[493] Fix | Delete
$this->is_admin = false;
[494] Fix | Delete
$this->is_attachment = false;
[495] Fix | Delete
$this->is_singular = false;
[496] Fix | Delete
$this->is_robots = false;
[497] Fix | Delete
$this->is_favicon = false;
[498] Fix | Delete
$this->is_posts_page = false;
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function