Changeset 52226 for trunk/src/wp-includes/class-wp-comment-query.php
- Timestamp:
- 11/20/2021 12:06:06 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-comment-query.php
r51806 r52226 142 142 * @since 4.6.0 Introduced the `$cache_domain` argument. 143 143 * @since 4.9.0 Introduced the `$paged` argument. 144 * @since 5.1.0 Introduced the `$meta_compare_key` argument. 145 * @since 5.3.0 Introduced the `$meta_type_key` argument. 144 146 * 145 147 * @param string|array $query { 146 148 * Optional. Array or query string of comment query parameters. Default empty. 147 149 * 148 * @type string $author_email Comment author email address. Default empty. 149 * @type string $author_url Comment author URL. Default empty. 150 * @type int[] $author__in Array of author IDs to include comments for. Default empty. 151 * @type int[] $author__not_in Array of author IDs to exclude comments for. Default empty. 152 * @type int[] $comment__in Array of comment IDs to include. Default empty. 153 * @type int[] $comment__not_in Array of comment IDs to exclude. Default empty. 154 * @type bool $count Whether to return a comment count (true) or array of 155 * comment objects (false). Default false. 156 * @type array $date_query Date query clauses to limit comments by. See WP_Date_Query. 157 * Default null. 158 * @type string $fields Comment fields to return. Accepts 'ids' for comment IDs 159 * only or empty for all fields. Default empty. 160 * @type int $ID Currently unused. 161 * @type array $include_unapproved Array of IDs or email addresses of users whose unapproved 162 * comments will be returned by the query regardless of 163 * `$status`. Default empty. 164 * @type int $karma Karma score to retrieve matching comments for. 165 * Default empty. 166 * @type string $meta_key Include comments with a matching comment meta key. 167 * Default empty. 168 * @type string $meta_value Include comments with a matching comment meta value. 169 * Requires `$meta_key` to be set. Default empty. 170 * @type array $meta_query Meta query clauses to limit retrieved comments by. 171 * See WP_Meta_Query. Default empty. 172 * @type int $number Maximum number of comments to retrieve. 173 * Default empty (no limit). 174 * @type int $paged When used with $number, defines the page of results to return. 175 * When used with $offset, $offset takes precedence. Default 1. 176 * @type int $offset Number of comments to offset the query. Used to build 177 * LIMIT clause. Default 0. 178 * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. 179 * Default: true. 180 * @type string|array $orderby Comment status or array of statuses. To use 'meta_value' 181 * or 'meta_value_num', `$meta_key` must also be defined. 182 * To sort by a specific `$meta_query` clause, use that 183 * clause's array key. Accepts 'comment_agent', 184 * 'comment_approved', 'comment_author', 185 * 'comment_author_email', 'comment_author_IP', 186 * 'comment_author_url', 'comment_content', 'comment_date', 187 * 'comment_date_gmt', 'comment_ID', 'comment_karma', 188 * 'comment_parent', 'comment_post_ID', 'comment_type', 189 * 'user_id', 'comment__in', 'meta_value', 'meta_value_num', 190 * the value of $meta_key, and the array keys of 191 * `$meta_query`. Also accepts false, an empty array, or 192 * 'none' to disable `ORDER BY` clause. 193 * Default: 'comment_date_gmt'. 194 * @type string $order How to order retrieved comments. Accepts 'ASC', 'DESC'. 195 * Default: 'DESC'. 196 * @type int $parent Parent ID of comment to retrieve children of. 197 * Default empty. 198 * @type int[] $parent__in Array of parent IDs of comments to retrieve children for. 199 * Default empty. 200 * @type int[] $parent__not_in Array of parent IDs of comments *not* to retrieve 201 * children for. Default empty. 202 * @type int[] $post_author__in Array of author IDs to retrieve comments for. 203 * Default empty. 204 * @type int[] $post_author__not_in Array of author IDs *not* to retrieve comments for. 205 * Default empty. 206 * @type int $post_ID Currently unused. 207 * @type int $post_id Limit results to those affiliated with a given post ID. 208 * Default 0. 209 * @type int[] $post__in Array of post IDs to include affiliated comments for. 210 * Default empty. 211 * @type int[] $post__not_in Array of post IDs to exclude affiliated comments for. 212 * Default empty. 213 * @type int $post_author Post author ID to limit results by. Default empty. 214 * @type string|array $post_status Post status or array of post statuses to retrieve 215 * affiliated comments for. Pass 'any' to match any value. 216 * Default empty. 217 * @type string|array $post_type Post type or array of post types to retrieve affiliated 218 * comments for. Pass 'any' to match any value. Default empty. 219 * @type string $post_name Post name to retrieve affiliated comments for. 220 * Default empty. 221 * @type int $post_parent Post parent ID to retrieve affiliated comments for. 222 * Default empty. 223 * @type string $search Search term(s) to retrieve matching comments for. 224 * Default empty. 225 * @type string|array $status Comment statuses to limit results by. Accepts an array 226 * or space/comma-separated list of 'hold' (`comment_status=0`), 227 * 'approve' (`comment_status=1`), 'all', or a custom 228 * comment status. Default 'all'. 229 * @type string|array $type Include comments of a given type, or array of types. 230 * Accepts 'comment', 'pings' (includes 'pingback' and 231 * 'trackback'), or any custom type string. Default empty. 232 * @type string[] $type__in Include comments from a given array of comment types. 233 * Default empty. 234 * @type string[] $type__not_in Exclude comments from a given array of comment types. 235 * Default empty. 236 * @type int $user_id Include comments for a specific user ID. Default empty. 237 * @type bool|string $hierarchical Whether to include comment descendants in the results. 238 * - 'threaded' returns a tree, with each comment's children 239 * stored in a `children` property on the `WP_Comment` object. 240 * - 'flat' returns a flat array of found comments plus 241 * their children. 242 * - Boolean `false` leaves out descendants. 243 * The parameter is ignored (forced to `false`) when 244 * `$fields` is 'ids' or 'counts'. Accepts 'threaded', 245 * 'flat', or false. Default: false. 246 * @type string $cache_domain Unique cache key to be produced when this query is stored in 247 * an object cache. Default is 'core'. 248 * @type bool $update_comment_meta_cache Whether to prime the metadata cache for found comments. 249 * Default true. 250 * @type bool $update_comment_post_cache Whether to prime the cache for comment posts. 251 * Default false. 150 * @type string $author_email Comment author email address. Default empty. 151 * @type string $author_url Comment author URL. Default empty. 152 * @type int[] $author__in Array of author IDs to include comments for. Default empty. 153 * @type int[] $author__not_in Array of author IDs to exclude comments for. Default empty. 154 * @type int[] $comment__in Array of comment IDs to include. Default empty. 155 * @type int[] $comment__not_in Array of comment IDs to exclude. Default empty. 156 * @type bool $count Whether to return a comment count (true) or array of 157 * comment objects (false). Default false. 158 * @type array $date_query Date query clauses to limit comments by. See WP_Date_Query. 159 * Default null. 160 * @type string $fields Comment fields to return. Accepts 'ids' for comment IDs 161 * only or empty for all fields. Default empty. 162 * @type int $ID Currently unused. 163 * @type array $include_unapproved Array of IDs or email addresses of users whose unapproved 164 * comments will be returned by the query regardless of 165 * `$status`. Default empty. 166 * @type int $karma Karma score to retrieve matching comments for. 167 * Default empty. 168 * @type string|string[] $meta_key Meta key or keys to filter by. 169 * @type string|string[] $meta_value Meta value or values to filter by. 170 * @type string $meta_compare MySQL operator used for comparing the meta value. 171 * See WP_Meta_Query::__construct for accepted values and default value. 172 * @type string $meta_compare_key MySQL operator used for comparing the meta key. 173 * See WP_Meta_Query::__construct for accepted values and default value. 174 * @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons. 175 * See WP_Meta_Query::__construct for accepted values and default value. 176 * @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons. 177 * See WP_Meta_Query::__construct for accepted values and default value. 178 * @type array $meta_query An associative array of WP_Meta_Query arguments. 179 * See WP_Meta_Query::__construct for accepted values. 180 * @type int $number Maximum number of comments to retrieve. 181 * Default empty (no limit). 182 * @type int $paged When used with `$number`, defines the page of results to return. 183 * When used with `$offset`, `$offset` takes precedence. Default 1. 184 * @type int $offset Number of comments to offset the query. Used to build 185 * LIMIT clause. Default 0. 186 * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. 187 * Default: true. 188 * @type string|array $orderby Comment status or array of statuses. To use 'meta_value' 189 * or 'meta_value_num', `$meta_key` must also be defined. 190 * To sort by a specific `$meta_query` clause, use that 191 * clause's array key. Accepts: 192 * - 'comment_agent' 193 * - 'comment_approved' 194 * - 'comment_author' 195 * - 'comment_author_email' 196 * - 'comment_author_IP' 197 * - 'comment_author_url' 198 * - 'comment_content' 199 * - 'comment_date' 200 * - 'comment_date_gmt' 201 * - 'comment_ID' 202 * - 'comment_karma' 203 * - 'comment_parent' 204 * - 'comment_post_ID' 205 * - 'comment_type' 206 * - 'user_id' 207 * - 'comment__in' 208 * - 'meta_value' 209 * - 'meta_value_num' 210 * - The value of `$meta_key` 211 * - The array keys of `$meta_query` 212 * - false, an empty array, or 'none' to disable `ORDER BY` clause. 213 * Default: 'comment_date_gmt'. 214 * @type string $order How to order retrieved comments. Accepts 'ASC', 'DESC'. 215 * Default: 'DESC'. 216 * @type int $parent Parent ID of comment to retrieve children of. 217 * Default empty. 218 * @type int[] $parent__in Array of parent IDs of comments to retrieve children for. 219 * Default empty. 220 * @type int[] $parent__not_in Array of parent IDs of comments *not* to retrieve 221 * children for. Default empty. 222 * @type int[] $post_author__in Array of author IDs to retrieve comments for. 223 * Default empty. 224 * @type int[] $post_author__not_in Array of author IDs *not* to retrieve comments for. 225 * Default empty. 226 * @type int $post_ID Currently unused. 227 * @type int $post_id Limit results to those affiliated with a given post ID. 228 * Default 0. 229 * @type int[] $post__in Array of post IDs to include affiliated comments for. 230 * Default empty. 231 * @type int[] $post__not_in Array of post IDs to exclude affiliated comments for. 232 * Default empty. 233 * @type int $post_author Post author ID to limit results by. Default empty. 234 * @type string|array $post_status Post status or array of post statuses to retrieve 235 * affiliated comments for. Pass 'any' to match any value. 236 * Default empty. 237 * @type string|array $post_type Post type or array of post types to retrieve affiliated 238 * comments for. Pass 'any' to match any value. Default empty. 239 * @type string $post_name Post name to retrieve affiliated comments for. 240 * Default empty. 241 * @type int $post_parent Post parent ID to retrieve affiliated comments for. 242 * Default empty. 243 * @type string $search Search term(s) to retrieve matching comments for. 244 * Default empty. 245 * @type string|array $status Comment statuses to limit results by. Accepts an array 246 * or space/comma-separated list of 'hold' (`comment_status=0`), 247 * 'approve' (`comment_status=1`), 'all', or a custom 248 * comment status. Default 'all'. 249 * @type string|array $type Include comments of a given type, or array of types. 250 * Accepts 'comment', 'pings' (includes 'pingback' and 251 * 'trackback'), or any custom type string. Default empty. 252 * @type string[] $type__in Include comments from a given array of comment types. 253 * Default empty. 254 * @type string[] $type__not_in Exclude comments from a given array of comment types. 255 * Default empty. 256 * @type int $user_id Include comments for a specific user ID. Default empty. 257 * @type bool|string $hierarchical Whether to include comment descendants in the results. 258 * - 'threaded' returns a tree, with each comment's children 259 * stored in a `children` property on the `WP_Comment` object. 260 * - 'flat' returns a flat array of found comments plus 261 * their children. 262 * - Boolean `false` leaves out descendants. 263 * The parameter is ignored (forced to `false`) when 264 * `$fields` is 'ids' or 'counts'. Accepts 'threaded', 265 * 'flat', or false. Default: false. 266 * @type string $cache_domain Unique cache key to be produced when this query is stored in 267 * an object cache. Default is 'core'. 268 * @type bool $update_comment_meta_cache Whether to prime the metadata cache for found comments. 269 * Default true. 270 * @type bool $update_comment_post_cache Whether to prime the cache for comment posts. 271 * Default false. 252 272 * } 253 273 */
Note: See TracChangeset
for help on using the changeset viewer.