Overview

Use this tool to create custom code for WordPress Comment Query with WP_Comment_Query class.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.

Examples

If you are still learning how to use this tool, check out the following examples:

The variable used in the code.
Show the comments loop.
Show comment by ID. Show comments based on comment parent id.
Show comments with certain status. Show comments with certain karma.
Show comments with certain type. Show comments based on custom type.
Show comments based on certain Post. Show comments based on post parent id.
Show comments based on post name. Show comments based on post author.
Show comments based on post status. Show comments based on post type.
Show comments based on certain User.
Show comments based on certain author email.
Ascending or Descending order.
Sort retrieved comments by.
Number of comments to show.
Number of comments to displace or pass over.
Display comments with this custom field key. Display comments with this custom field value.
Operator to test the custom field value. Custom field type.
The total count of comments found.

  Save Snippet
// WP_Comment_Query arguments
$args = array (
);

// The Comment Query
$comment_query = new WP_Comment_Query;
$comments = $comment_query->query( $args );