WP_Comment_Query Generator

Home » WordPress Generators » WP_Comment_Query Generator

Related query generators WP query generator WP tax query generator WP user query generator Go back to all generators

The query variable to use for this snippet.
Add The Loop
Whether to add the display loop code to the snippet.
Count Only
Whether to only return a count of the number of results.
Comma-seperated list of comment IDs to query.
Comma-seperated list of comment IDs to exclude from the query.
Comma-seperated list of comment IDs to query as parents.
Comma-seperated list of comment IDs to exclude from the query as parents.
The comment status to query.
The comment karma to query.
The comment type to query.
The custom comment type to query.
Comma-seperated list of comment author IDs to query.
Comma-seperated list of comment author IDs to exclude from the query.
The comment author email to query.
Comma-seperated list of post IDs to query.
Comma-seperated list of post IDs to exclude from the query.
The post name to query.
The post status to query.
Comma-seperated list of custom post statuses to query.
Comma-seperated list of post types to query.
The parent post ID to query.
The post author to query.
The number of comments to query.
The number of comments to offset the query by. Basically, this is page number.
The order to query.
The order direction to query.
                    $query_args = array(
	'number' => 10,
	'order' => 'DESC',
);

$query = new WP_Query( $query_args );

if ( ! empty( $query ) && ! is_wp_error( $query ) ) {
	// The Loop
}
else {
	// no terms found
}
                

Sign up to save your WordPress snippets on WPTurbo.