Skip to content

Commit

Permalink
Merge pull request #154 from 10up/feature/152-disable-comments-and-co…
Browse files Browse the repository at this point in the history
…mments-ui

Disable comments and comments related UI
  • Loading branch information
darylldoyle authored Aug 22, 2024
2 parents c010d61 + ad8cb83 commit d1349fd
Show file tree
Hide file tree
Showing 5 changed files with 416 additions and 20 deletions.
1 change: 1 addition & 0 deletions 10up-experience.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function ( $class_name ) {
API\API::instance();
Authentication\Usernames::instance();
Authors\Authors::instance();
Comments\Comments::instance();
Gutenberg\Gutenberg::instance();
Headers\Headers::instance();
Plugins\Plugins::instance();
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,52 @@ Filters how many log items to store. Items are stored in array saved to the opti

Define `TENUP_DISABLE_ACTIVITYLOG` as `true` to disable Activity Log.

### Comments

10up Experience includes a feature to disable comments across the site. This feature can be enabled or disabled in `Settings > General`. It is disabled by default.

On top of disabling the comment form, this feature removes the following:

- Comments from the admin menu.
- Comment blocks from the post editor.
- Comments from the admin bar.

#### Constants

- `TENUP_DISABLE_COMMENTS`

Define this as `true` to force disable comments or `false` to enable comments from a config file.
Setting this constant will disable the UI for enabling/disabling comments in the admin.

#### Filters

- `tenup_experience_disable_comments`

Filters whether to disable comments. Default is `false`.
Defining this filter will disable the UI for enabling/disabling comments in the admin.

- `tenup_experience_disable_comments_disallowed_blocks`

Filters the list of blocks that should be disallowed when comments are disabled. This is useful when core adds new blocks that aren't covered by the default list.

The default list of disallowed blocks is:

- `core/comment-author-name`
- `core/comment-content`
- `core/comment-date`
- `core/comment-edit-link`
- `core/comment-reply-link`
- `core/comment-template`
- `core/comments`
- `core/comments-pagination`
- `core/comments-pagination-next`
- `core/comments-pagination-numbers`
- `core/comments-pagination-previous`
- `core/comments-title`
- `core/post-comments`
- `core/post-comments-form`
- `core/latest-comments`

## Support Level

**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
Expand Down
Loading

0 comments on commit d1349fd

Please sign in to comment.