# Comment Form Shortcode

## `sce_comment_form` Shortcode

The `sce_comment_form` shortcode outputs the native WordPress comment form anywhere shortcodes are supported (Classic Editor, widgets, template content, etc.).

It mirrors WordPress’s built-in `comment_form()` functionality while adding **control over where and how many comment forms appear**, including support for multiple forms on a single page and cross-posting comments to a different post or page.

***

### Basic Usage

```
[sce_comment_form]
```

Outputs the default WordPress comment form for the current post.

***

### Shortcode Attributes

#### Visibility & Display Controls

| Attribute                      | Type            | Default | Description                                                                                                  |
| ------------------------------ | --------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| `hide_secondary_comment_forms` | boolean         | `false` | Hides all *other* comment forms rendered after this one. Useful when multiple comment forms exist on a page. |
| `hide_on_comment_pagination`   | boolean         | `false` | Hides the comment form when viewing paginated comment pages (`?cpage=2`, etc.).                              |
| `hide_all_comment_forms`       | boolean         | `false` | Prevents **any** comment form from rendering (including this shortcode instance).                            |
| `post`                         | integer \| null | `null`  | The post ID the comment form should submit comments to. Defaults to the current post if not set.             |

***

#### Supported `comment_form()` Attributes

This shortcode also supports **all standard `comment_form()` arguments**, including but not limited to:

* `id_form`
* `id_submit`
* `class_container`
* `class_form`
* `class_submit`
* `name_submit`

These are passed directly through to WordPress’s `comment_form()` function.

See [comment\_form](https://developer.wordpress.org/reference/functions/comment_form/) for arguments. Non-array/object values can be passed straight through.

***

### Examples

#### 1. Basic Comment Form

```
[sce_comment_form]
```

Outputs the default comment form for the current post.

***

#### 2. Post Comments to a Different Page or Post

```
[sce_comment_form post="42"]
```

Comments submitted through this form will be attached to post ID `42`, regardless of where the shortcode appears.

**Use case:**\
Landing pages, sales pages, or hubs that funnel discussion to a single post.

***

#### 3. Hide the Comment Form on Paginated Comment Pages

```
[sce_comment_form hide_on_comment_pagination="true"]
```

Prevents the comment form from appearing on comment pagination pages such as:

```
/post-name/?cpage=2
```

***

#### 4. Allow Only One Comment Form on the Page

```
[sce_comment_form hide_secondary_comment_forms="true"]
```

Ensures that only the **first** rendered comment form is displayed, even if:

* The theme outputs a comment form
* Another shortcode instance appears later
* Another plugin adds a comment form

***

#### 5. Hide All Comment Forms (Including Native Ones)

```
[sce_comment_form hide_all_comment_forms="true"]
```

Suppresses **all** comment forms on the page.

**Use case:**\
Temporarily disabling comments on specific pages without changing global discussion settings.

***

#### 6. Customize Form IDs and Classes

```
[sce_comment_form 
	id_form="custom-comment-form"
	class_form="my-comment-form"
	class_submit="my-submit-button"
]
```

Useful for targeting the form with custom CSS or JavaScript.

***

### Behavior Notes

* The shortcode uses WordPress’s native `comment_form()` internally, ensuring compatibility with:
  * Core comment handling
  * Themes
  * Anti-spam plugins
  * Comment moderation workflows
* Output buffering is used to safely capture and suppress additional comment forms when requested.
* Multiple shortcode instances are supported on the same page.

***

### When to Use This Shortcode

This shortcode is especially useful when:

* You’re working on **Classic Editor** or shortcode-based layouts
* You need **multiple comment forms** on a single page
* You want comments submitted to a **different post**
* You want **precise control** over when and where comment forms appear
* Creating a block would be unnecessary or redundant


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dlxplugins.com/comment-edit-pro/features-overview/comment-form-shortcode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
