Skip to content

Comment Generation

Comment generation creates realistic, threaded comment discussions on your WordPress posts for testing themes, moderation workflows, comment plugins, and any scenario where you need populated comment sections without manually typing dozens of fake responses. WPfaker distributes comments across your published posts with a natural mix of anonymous visitors and registered users, varying content lengths, nested reply threads, and configurable moderation states. Every generated comment is tracked with _wpfaker_generated meta for easy cleanup through the History system, so you can experiment freely and remove everything when you are done.

Unlike manually creating test comments one at a time through the WordPress admin, WPfaker's comment generator produces entire conversations in seconds — complete with realistic metadata like browser user agent strings, IPv4 addresses, and chronologically consistent timestamps. The result is comment sections that look and behave like real user discussions, which is essential for testing comment display themes, pagination, moderation queues, and performance under load.

Comment generation page

Post Type Selection

WPfaker only displays post types that have comment support enabled in their registration. Standard WordPress posts always appear, but custom post types will only show up if they were registered with 'supports' => ['comments'] or had comment support added via add_post_type_support(). If you do not see a custom post type in the dropdown, check its registration code to confirm that comment support is declared.

When you select a post type and trigger generation, WPfaker queries for published posts of that type where comments are currently open. Posts in draft, pending, or private status are excluded, as are posts where the comment status has been set to "closed" either manually or through WordPress's automatic comment closing settings. This filtering ensures that generated comments land only on posts where real visitors could actually leave comments, producing a realistic test environment.

The query is limited to 100 eligible posts and returns them in random order. This cap exists to keep the generation process performant and prevent excessive database queries on sites with thousands of posts. If you have more than 100 eligible posts, WPfaker selects a random subset, which means repeated generation runs will likely target different posts — a useful property for gradually building up comment activity across a large site. If you need comments on specific posts, you can use the post_ids parameter in the REST API to target them directly.

Comment Count

The Comments Per Post slider controls the maximum number of comments each eligible post receives, with a range of 1 to 50 (default 15). For each post, WPfaker picks a random number between 1 and the configured maximum, so the total comment count across all posts varies with every generation run.

When you have many eligible posts and a high per-post maximum, the total comment count can grow quickly. Ten posts with a max of 15 comments each could produce up to 150 comments in a single run. Conversely, if you only have two or three published posts, all generated comments concentrate on those few posts, which is useful for testing how your theme handles long comment threads and pagination.

Threading and Nesting

WPfaker generates threaded comment discussions using a two-phase algorithm that respects WordPress's native threading settings. The result is realistic conversation trees where replies are properly nested under their parent comments, with timestamps that always flow chronologically from parent to child.

The Two-Phase Algorithm

Phase 1 creates the foundation of each comment section by generating top-level comments. At least 30% of the total comments for each post are guaranteed to be top-level, meaning they appear as direct responses to the post itself rather than replies to other comments. This minimum ensures that every post has a healthy base of standalone comments, even when the reply probability is set high. Without this floor, aggressive reply settings could produce a comment section that is nothing but nested replies with very few root comments — an unrealistic pattern that rarely occurs on real sites.

Phase 2 generates the remaining comments, each of which has a 40% chance of being a reply to an existing comment. At this probability, roughly four out of every ten Phase 2 comments become replies, while the rest become additional top-level comments.

Thread Depth

When a comment is designated as a reply, WPfaker checks the WordPress thread_comments_depth setting (found under Settings > Discussion > Enable threaded comments X levels deep). The default depth is 5 levels. If a potential parent comment is already at the maximum depth, WPfaker either selects a shallower parent or creates a top-level comment instead. This ensures that generated threads never exceed the depth your theme is configured to display, which is important because many themes have CSS styling only for a specific number of nesting levels.

Chronological Consistency

Reply comments always receive timestamps that fall after their parent comment's date. WPfaker calculates each reply's date as a random point between the parent comment's timestamp and the current time, with a minimum gap of one minute. This guarantees that comment threads read chronologically from top to bottom when sorted by date, just as they would in a real conversation. Top-level comments use the post's publish date as their earliest possible timestamp, so you never see comments that appear to have been written before the post was published.

TIP

For testing deeply nested reply threads, increase the comments per post slider to 15 or more. The hardcoded 40% reply probability produces natural conversation chains that exercise your theme's nested comment CSS and the "Reply" button functionality at every depth level. You can override reply_probability via the REST API for more aggressive threading.

Comment threading configuration

Content Variation

Generated comment content follows a four-tier distribution that mimics real-world commenting patterns, where most comments are brief and only a few are lengthy:

ProbabilityLengthDescription
30%1 short sentenceQuick reactions of 4 to 10 words, like "Great post, thanks for sharing!"
40%1-2 sentencesStandard comments of 5 to 12 words per sentence, offering a brief thought or question
20%1 paragraphMore substantive responses with 3 to 4 sentences developing a point
10%2 paragraphsDetailed replies that provide extended feedback or discussion

This distribution reflects how people actually comment on blogs. The majority of real comments are short acknowledgments or quick questions, with a smaller percentage of thoughtful, longer responses. By weighting the distribution this way, WPfaker produces comment sections that feel natural rather than uniformly wordy or uniformly terse.

Content variation matters because it directly affects how your theme renders comment text. Short one-line comments test whether your comment bubbles or containers look good with minimal content. Longer multi-paragraph comments test text wrapping, paragraph spacing, and whether your comment layout handles substantial blocks of text without visual issues. Having all four tiers represented in every generation run means you are testing the full range of content lengths your theme will encounter in production.

All comment content is generated using the Faker library, which produces grammatically plausible sentences in the configured locale. This means comments generated with a German locale will contain German-language text, while a Japanese locale produces Japanese text. See Language Support for details.

Anonymous and Registered Commenters

The Use Existing Users toggle controls whether comments come from registered WordPress users or anonymous visitors. When disabled (the default), 70% of comments come from anonymous commenters while the remaining 30% come from existing WordPress user accounts. When enabled, all comments are attributed to existing WordPress users with 0% anonymous commenters. This toggle reflects the typical pattern on most WordPress sites, where the majority of comments are from visitors who are not logged in.

Anonymous Commenters

Anonymous comments are created with realistic fake identities. Each anonymous commenter receives a fake display name generated by the Faker library in the current locale, an email address using the @example.com domain (reserved by RFC 2606 for testing, so these emails can never reach real mailboxes), and a 30% chance of including a website URL. The website URL, when present, points to a plausible but fake domain, mimicking the common behavior of commenters who fill in the optional website field to promote their own site.

Because anonymous commenters use @example.com addresses, they are easily distinguishable from real comments in your WordPress admin. You can filter or search for @example.com to quickly identify generated comments even outside of WPfaker's History interface.

Registered User Comments

For the non-anonymous portion, WPfaker fetches up to 50 existing WordPress user accounts and randomly selects from them for each comment. Registered user comments use the user's actual display name, real email address, and WordPress user ID, which means they are linked to the user's profile just like a genuine logged-in comment. This is important for testing themes that display user avatars, roles, or profile links next to comments from registered users.

If your WordPress installation has no users (other than the admin), or if the user query returns empty results, WPfaker automatically falls back to creating anonymous comments for the full 100%. This graceful fallback means you never need to worry about the registered percentage causing errors on a fresh installation — it simply adapts to what is available.

INFO

The anonymous percentage is evaluated per comment using rand(1, 100). At 70%, each individual comment has a 70% chance of being anonymous, so the actual ratio across a batch will be approximately but not exactly 70/30. Over larger batches, the ratio converges more closely to the configured percentage.

Moderation Status

WPfaker sets 10% of generated comments to "pending" approval status. The remaining 90% are auto-approved and visible to visitors. This ratio is hardcoded and not configurable through the UI.

This mix is useful for testing moderation workflows. Many WordPress sites rely on comment moderation as a first line of defense against spam, and themes often style pending comments differently (or hide them entirely from non-admin users). The 10% pending rate produces a realistic moderation queue without overwhelming it, letting you verify that your theme handles both approved and pending states correctly.

TIP

Use the History system to test the full moderation cycle: generate comments, approve or reject the pending ones through your workflow, then clean up via History and start fresh.

Comment Metadata

Every comment generated by WPfaker carries the _wpfaker_generated meta flag, which serves as the foundation for tracking, management, and cleanup. This meta field is what allows WPfaker to distinguish its generated comments from real ones, enabling targeted deletion without affecting genuine user comments.

Realistic Technical Metadata

Beyond the tracking flag, each comment includes realistic technical metadata that mirrors what WordPress stores for genuine comments. The user agent string is randomly selected from a pool of six modern browser signatures, covering current versions of Chrome, Firefox, and Safari across Windows, macOS, Linux, iOS, and Android. The IP address is a randomly generated IPv4 address, giving each comment a unique network origin. These details matter when testing plugins that analyze comment metadata for spam detection, geographic analytics, or security logging.

The comment date is calculated as described in the Threading section — always chronologically consistent with parent comments and the post publication date. The comment author email, name, and optional URL are populated based on whether the comment is anonymous or from a registered user, as described in the commenter section.

History Tracking and Dashboard Stats

Generated comments appear in three places within WPfaker. The History tab provides a complete log of all generated comments with their IDs, associated posts, and generation timestamps. You can filter, review, and delete comments individually or in bulk from this interface. The Dashboard displays a dedicated comment counter so you can see at a glance how many fake comments exist across your site. Finally, generated comments appear in the standard WordPress Comments admin page as regular comments, indistinguishable from real ones except for the hidden _wpfaker_generated meta.

This triple visibility is by design. Generated comments should behave exactly like real comments in every way that matters for testing — appearing in admin lists, triggering notification emails, counting toward comment totals, and rendering in front-end templates. The WPfaker-specific tracking layer sits quietly underneath, ready for cleanup when testing is complete.

Generated comments in WordPress

Profile Pictures for Commenters

WPfaker assigns downloaded portrait photos to 60% of generated commenters. The remaining 40% display the default Gravatar placeholder. This ratio is hardcoded and not configurable through the UI. The result is a visually varied comment section where some commenters have faces and others show generic avatars, closely mimicking what real comment sections look like on most WordPress sites.

The Pool Approach

Rather than downloading a unique image for every single commenter, WPfaker uses a pool-based approach. It downloads up to 15 portrait images for comment generation (compared to up to 20 for user generation). These portraits are square, 400x400 pixel images searched with terms like "portrait face headshot person" from the configured image provider, and stored as WordPress media library attachments.

The 15-image cap keeps download times reasonable while providing enough visual variety that comment sections do not look like the same person commenting repeatedly. With 15 unique portraits distributed across dozens of comments, you get a realistic mix of faces without the overhead of downloading an image per comment.

Random Assignment

Unlike user generation, which distributes avatars in a round-robin pattern (each portrait used roughly equally), comment avatars use random selection. WPfaker shuffles the downloaded portrait pool and slices it to the needed count, then assigns them randomly to the comments selected for avatars. This produces a more natural distribution where some portraits might appear more frequently than others, just as in a real comment section where a few active commenters return multiple times while others comment only once.

How WordPress Serves Comment Avatars

WPfaker hooks into WordPress's pre_get_avatar_data filter to intercept avatar requests and serve downloaded portraits instead of Gravatar lookups. When WordPress needs to display an avatar, the filter checks several sources in order:

For WP_Comment objects, it first checks the comment's own meta for a stored _wpfaker_avatar_id attachment ID. If found, that attachment's URL is used as the avatar. If the commenter is a registered user and no comment-level avatar exists, the filter falls back to checking the user's meta for a user-level avatar (which would exist if the user was created through user generation).

For email string lookups (used by some themes and plugins), the filter attempts a user lookup by email first, then falls back to a SQL join on the comment meta table to find any comment with that email that has an associated avatar.

This layered approach means avatars appear everywhere WordPress calls get_avatar() — in the admin comments list, front-end comment threads, author profile pages, and any plugin or widget that renders user avatars. The coverage is automatic and requires no theme modifications.

Interaction with Existing Avatars

When a registered WordPress user already has an avatar — either from Gravatar, from WPfaker's user generation, or from a profile picture plugin — the comment-level avatar takes precedence if one was assigned. This means a registered user might show their normal avatar on some comments and a different WPfaker-assigned portrait on others, depending on whether that particular comment received a random avatar assignment. In practice, this is rarely noticeable during testing, but if you want consistent avatars for registered users, generate user avatars through user generation and set the comment avatar percentage to focus only on anonymous commenters.

Provider Selection

Comment avatars use the same image provider configured in your image settings. The available providers are LoremFlickr, Unsplash, and Lorem Picsum, each sourcing portrait-style photographs. The provider selection applies globally — you cannot use one provider for user avatars and another for comment avatars. All downloaded portraits are stored as permanent WordPress media library attachments and persist until manually deleted or cleaned up through the History system.

Performance Considerations

Each portrait download includes a 200ms delay between requests to respect the rate limits of image providers. With a pool cap of 15 images, the maximum download overhead is approximately 3 seconds (15 images x 200ms). This delay is modest but noticeable during generation, especially compared to comment creation itself, which is almost instantaneous.

The avatar percentage is hardcoded at 60% in the UI. To skip portrait downloads entirely for faster generation, use the REST API with avatar_percentage set to 0.

Auto-Generation During Post Creation

When generating posts through the post generation panel, you can enable automatic comment generation in the Comments accordion section. This accordion only appears for post types that have comment support enabled, so you will not see it when generating pages or custom post types without comments.

The auto-generation settings mirror the standalone comment generator but are scoped to each individual post as it is created. You configure a comments per post count and a threading toggle. As each post is generated, WPfaker immediately creates its comment thread using these settings, so you end up with fully populated posts complete with discussion threads in a single generation run.

Auto-generated comments are tracked in History separately from the posts themselves. This separation means you can delete all generated comments without affecting the generated posts, or vice versa. It also means that comment counts in the History and Dashboard reflect the total across both standalone and auto-generated comments, giving you an accurate picture of all fake comments on your site.

TIP

Auto-generation is the fastest way to create a realistic blog with populated comment sections. Generate 10 to 20 posts with auto-comments enabled, and you immediately have a site that looks like it has an active community — perfect for client demos, theme reviews, or screenshot sessions.

Comments displayed on frontend

Templates

Comment generation settings can be stored in templates alongside other generation parameters. When you save a template, the configurable comment settings are preserved: post type, comments per post, threading toggle, and use existing users toggle. Loading a template restores these values, letting you quickly switch between different comment generation profiles.

Template comment settings also apply when using the REST API with a template ID parameter. This means automated testing scripts can reference a named template to generate comments with consistent, pre-defined settings across multiple test runs.

Language Support

Comment content and commenter names are generated in the locale configured in your Language settings or overridden per generation run. The locale affects the language of generated comment text (sentences and paragraphs), the first and last names of anonymous commenters, and the biographical style of the content.

For example, generating comments with the de_DE locale produces German-language comment text and German names like "Thomas Wagner" and "Anna Schmidt." Switching to ja_JP generates Japanese text and Japanese names. This locale awareness is essential when testing themes that display comments in non-English languages, as different character sets and text directions can reveal layout issues that English-only testing would miss.

The locale for auto-generated comments during post creation follows the same locale setting as the parent post generation, ensuring linguistic consistency between posts and their comment threads. You do not need to configure the locale separately for comments when using auto-generation.

TIP

Comment content is locale-aware. Set the locale parameter to generate comments in the appropriate language for your testing scenario. This is especially important for themes that need to handle multilingual content or right-to-left scripts.

Danger Zone

The comment generator includes a Delete Existing Comments toggle in the Danger Zone section. When enabled, WPfaker permanently removes all previously generated comments before creating the new batch. Only comments carrying the _wpfaker_generated meta flag are affected — genuine user comments are never touched.

The deletion can be filtered by post type. If you select "post" as your target post type and enable Delete Existing, only generated comments on posts are removed. Generated comments on custom post types or pages remain untouched. This scoping lets you clean up and regenerate comments for one content type without disrupting test data on others.

The Delete Existing option is useful when you want a fresh start — for example, after testing one theme's comment rendering and switching to another, or when you have been iterating on comment settings and want to clear out accumulated test data before a final generation run with your preferred configuration.

DANGER

Deleting comments is permanent and cannot be undone. The deletion targets all WPfaker-generated comments matching the selected post type, regardless of when they were created. If you need to preserve some generated comments while removing others, use the History page for selective deletion instead.

REST API

You can generate comments programmatically through the WPfaker REST API, which is useful for automated testing scripts, CI/CD pipelines, or custom admin interfaces.

Generate Comments

POST /wpfaker/v1/generate/comments

Parameters:

json
{
  "post_type": "post",
  "post_ids": [],
  "comments_per_post_min": 1,
  "comments_per_post_max": 15,
  "enable_threading": true,
  "reply_probability": 40,
  "pending_percentage": 10,
  "anonymous_percentage": 70,
  "avatar_percentage": 60,
  "delete_existing": false
}

The post_ids parameter accepts an array of specific post IDs to target. When provided, WPfaker generates comments only on those posts, bypassing the normal query for eligible published posts.

The UI hardcodes reply_probability (40), pending_percentage (10), anonymous_percentage (70 or 0), and avatar_percentage (60). The REST API accepts these as parameters, so you can override them in programmatic calls.

All parameters are optional and fall back to their defaults when omitted. See the Generation API reference for complete response formats and error codes.

Auto-Comments via Post Generation

Add these parameters to POST /wpfaker/v1/generate/posts to include comment generation as part of post creation:

json
{
  "auto_comments": true,
  "comments_per_post_min": 1,
  "comments_per_post_max": 10,
  "enable_comment_threading": true,
  "comment_reply_probability": 40
}

Note that the parameter names differ slightly from standalone comment generation — enable_comment_threading and comment_reply_probability have the comment_ prefix to avoid conflicts with other post generation parameters.

Use Cases

Theme comment template testing is the most common use case for comment generation. Every WordPress theme renders comments differently — some use nested bubbles, others use flat lists, and many include features like author highlighting, avatar sizing, and reply-to-reply interfaces. Generating a full range of comments with threading, varying lengths, and mixed avatar states exercises every part of your comment template. Generate 10 to 15 comments per post with 40% reply probability to see how your theme handles a realistic conversation thread, including deep nesting, long comment text, and the visual distinction between anonymous and registered commenters.

Moderation workflow testing requires a queue of pending comments to work with. Set the pending percentage to 30% or 50% and generate a large batch of comments. This fills your WordPress moderation queue with realistic entries that you can approve, reject, spam-mark, and bulk-manage. This is essential for testing custom moderation interfaces, email notification templates, and any plugins that extend WordPress's comment management capabilities.

Performance and pagination testing benefits from high comment volumes. Set the min and max per post to 15, target a post type with many published posts, and generate a batch. The resulting hundreds of comments test how your theme paginates long comment threads, whether your server handles large comment queries efficiently, and how your caching layer responds to high comment counts. This kind of load testing is difficult to do manually but trivial with WPfaker.

Comment plugin compatibility testing covers any plugin that extends WordPress comments — whether it is a spam filter like Akismet, a comment styling plugin, a notification system, or a social commenting replacement. Generated comments exercise the WordPress comment API in the same way real comments do, so any plugin that hooks into wp_insert_comment, pre_get_avatar_data, or the comment template hierarchy will interact with WPfaker's comments exactly as it would with real ones.

Client demos and screenshots often need populated comment sections to look convincing. Generate comments with 60% avatars, a mix of threading, and varied content lengths to create comment sections that look active and engaged. The combination of real portrait photos and natural-language text produces screenshots that are indistinguishable from a live site with real users.

Multilingual site testing uses the locale parameter to generate comments in specific languages. If your site serves multiple languages, generate separate batches with different locales to verify that your comment template handles various character sets, text lengths, and formatting conventions correctly.

Best Practices

Start with the default settings for your first generation run. The defaults of 1 to 15 comments per post, 40% reply probability, 70% anonymous, 10% pending, and 60% avatars are calibrated to produce realistic-looking comment sections out of the box. The UI exposes the comments-per-post slider, threading toggle, and use-existing-users toggle. The remaining values are hardcoded but can be overridden through the REST API.

Generate users before generating comments if you want a diverse pool of registered commenters. WPfaker pulls up to 50 existing WordPress users for registered comments, so having a variety of users with different roles and display names produces more realistic comment sections. Run user generation first with 10 to 20 users, then generate comments with the anonymous percentage set to 50% or 60% to see a healthy mix of registered and anonymous commenters.

Use the Danger Zone's Delete Existing option between testing iterations rather than accumulating comments across multiple runs. Stacking comments from repeated generation runs can produce unrealistic comment counts and make it harder to evaluate your current settings. A clean slate for each testing session gives you more control over the results.

Portrait downloads add a few seconds per batch due to the 200ms delay between requests. The UI always uses 60% avatar assignment. For faster iteration during early development, use the REST API with avatar_percentage set to 0 to skip portrait downloads entirely.

The UI hardcodes pending percentage at 10%. To test with a higher pending rate (30-50%), use the REST API's pending_percentage parameter. This is useful when your production site uses "Comment must be manually approved" in WordPress Discussion settings.

Test with multiple locales if your theme will be used internationally. Even if your own site is English-only, themes distributed publicly need to handle comment text in different languages gracefully. Generate a batch with de_DE, then ja_JP, then ar to verify that your comment template renders correctly across Latin, CJK, and right-to-left scripts.

Released under the GPL2 License. wpfaker.com