10up-experience icon indicating copy to clipboard operation
10up-experience copied to clipboard

Disable comments and comments related UI

Open sksaju opened this issue 11 months ago • 4 comments

Description of the Change

Closes https://github.com/10up/10up-experience/issues/152

How to test the Change

Changelog Entry

Added - New feature Changed - Existing functionality Deprecated - Soon-to-be removed feature Removed - Feature Fixed - Bug fix Security - Vulnerability

Credits

Props @username, @username2, ...

Checklist:

  • [ ] I agree to follow this project's Code of Conduct.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my change.
  • [ ] All new and existing tests pass.

sksaju avatar Mar 10 '24 20:03 sksaju

@darylldoyle I've removed comments support from every post type, but please let me know if it should be specified! Thanks

sksaju avatar Mar 10 '24 20:03 sksaju

@sksaju thanks for your work on this! This is a great start, removing the UI elements from the admin, but this should also disable the comments form etc on the front end of the site.

See something like https://keithgreer.dev/wordpress-code-completely-disable-comments-using-functions-php/ for inspiration.

I also wonder if we should make it an option within the admin UI, whether they're enabled or not 🤔

Thanks for your feedback @darylldoyle, I've updated the PR, please retake a look. Thanks

sksaju avatar Mar 25 '24 09:03 sksaju

@sksaju @darylldoyle Is it too late to request an additional feature? It would be nice to provide a filter to set the option value as well as a wp-config constant to also set this value. Meaning that we can disable or enable comments in three places; wp-config, themes or plugins, and the wp-admin. I've done something similar in a personal plugin that might help explain the idea.

https://github.com/claytoncollie/tracking-code-for-google-analytics/blob/master/inc/tracking-id.php

claytoncollie avatar May 02 '24 14:05 claytoncollie

@sksaju @darylldoyle Is this PR only to handle UI elements or be something a bit more comprehensive like some of the open source plugins? If more comprehensive, I suggest looking through the code from Uncomment. It is built by a 10upper, Barry Ceelen, and takes into account blocks, queries, UI, admin, and frontend. I have used it on a few sites and really like it.

claytoncollie avatar May 02 '24 16:05 claytoncollie

@claytoncollie, thanks for the feedback! Can you check if this now solves your concerns? I've added in logic to remove the comment blocks and widgets when comments are disabled and I've added a const and filter that allow you to disable it other ways (I appreciate the sample there)

darylldoyle avatar Aug 22 '24 09:08 darylldoyle

@darylldoyle Very nice. Thank you for the additions.

claytoncollie avatar Aug 22 '24 12:08 claytoncollie