Skip to main content
Cookbook Maintenance Disable Comments

Find Out Why Visitors Can’t Comment on a Post with AI

Check the post's setting, WordPress's discussion settings, Disable Comments' rules and the page itself, and get the one thing that decides it.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running Disable Comments 2.9 or newer (tested on 2.9.0, the free plugin) on WordPress 6.9 or newer.

The prompt
My WordPress site uses the Disable Comments plugin. Visitors [can't / can] comment on [post title or URL] and I want to know why. Don't change anything.

1. Find the post with GET /wp/v2/search?search=[title] (or from the URL), then read it with GET /wp/v2/[its REST base]/[id]?context=edit&_fields=id,type,date,status,comment_status. If comment_status is closed, that closes it whatever else is set. If it is open, that is only the post's own setting: Disable Comments can still close it without changing this field (step 3).
2. Run run_wp_cli option get close_comments_for_old_posts, then close_comments_days_old, then comment_registration. If the first is 1, the post is a blog post (WordPress applies this to posts only by default) and it is older than that many days, WordPress closed it. If comment_registration is 1, only logged-in users can comment.
3. Run discover_abilities with category disable-comments. If the ability this needs is not there, stop and tell me to install or update the free Disable Comments plugin (2.9 or newer, on WordPress 6.9 or newer). Then run disable-comments/get-status. Check whether the post's type is in disabled_post_types, or comments_disabled_everywhere is true, and whether auto_close_days is above 0 and the post is older. For a product, also check product_reviews_disabled_by (woocommerce means WooCommerce's own Enable reviews setting is off) and blocked_comment_types, and run option get woocommerce_review_rating_verification_required: yes means only logged-in buyers see the review form. If conditional_rules_enabled is true, tell me that rules by category, template or age may apply to this post and that they are set in Disable Comments' settings. If role_exclusion_enabled is true, tell me some roles, or logged-out visitors if that option is ticked, still see the form.
4. Fetch the post as a visitor with get_page_html, selector #commentform and max_length 2000. A notice that the selector matched nothing means there is no comment form (with comment_registration on, visitors see a log-in message instead).
5. Tell me which of these decides it, in one or two sentences, and the one change that would fix it (the post's own Allow comments setting, the discussion settings, WooCommerce's review setting, or Disable Comments). If everything says open but the form is missing, say my theme or a host or CDN cache is the likely cause. Wait for me before changing anything.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Find Out Why Visitors Can’t Comment on a Post with AI” recipe from the WPVibe cookbook on my connected site.

A reader says they can’t comment, or a post you expected to stay closed has a comment form. In WordPress four different places decide that: the post’s own setting, the discussion settings for older posts, Disable Comments’ rules, and your theme.

The AI checks each one in order for the post you name and tells you which one decides, in plain words, without changing anything. Then it tells you the one change that would fix it, and waits.

Disable Comments can exempt user roles and set rules by category, template or age, so what you see logged in can differ from what a visitor sees. The AI checks the page as a logged-out visitor. Want comments off for good instead? Use this recipe.

Outcome

You know which setting opens or closes comments on that post, and the one change that would fix it, with nothing changed yet.