No Comments on Media
Disable comments on media
by Bitwise Software · github.com/zdrave08/no-comments-on-media · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/zdrave08/no-comments-on-media/archive/refs/heads/main.zipMinimal WordPress plugin that automatically disables comments on media attachments.
📋 Description
No Comments on Media is an ultra-lightweight plugin that automatically disables comments on all media attachment pages. No complications, no bloat - just clean, minimal code.
Why do you need this plugin?
Media attachment pages (images, videos, PDFs) rarely need comments. This plugin:
✅ Improves SEO - Removes unnecessary comment sections
✅ Increases security - Reduces spam and potential security vulnerabilities
✅ Cleans your site - More professional appearance of attachment pages
✅ Saves resources - Fewer database queries, faster loading
✨ Features
🎯 Core Features
- Automatic comment disabling - Comments can no longer be added to attachments
- Disables trackbacks/pingbacks - Complete spam protection
- Removes Comments section - Completely hides comment form and existing comments
- Theme-agnostic - Works with any WordPress theme
- Simple ON/OFF toggle - Easy control in Settings → Media
- Auto-close on activation - Closes comments on all existing attachments upon activation
🎁 Bonus Features
- Optional comment deletion - Toggle to permanently delete existing comments on attachments
- WP-CLI support - Professional commands for developers and system admins
- Status monitoring - Display current state of comments on media
🚀 Installation
Automatic installation (WordPress.org)
- Go to Plugins → Add New
- Search for "No Comments on Media"
- Click "Install Now" and then "Activate"
- Done! Plugin works automatically
Manual installation
- Download plugin files
- Upload folder to
/wp-content/plugins/ - Activate plugin through Plugins menu
- Plugin starts working automatically
📖 Usage
Plugin works automatically after activation. To control functionality:
Admin Panel
- Go to Settings → Media
- Find "Comments on Media" section
- Configure options:
- ☑ Disable comments on all media attachments - Main functionality
- ☑ Delete existing comments on attachments - ⚠️ Permanently deletes comments (optional)
- Save changes
Plugin is enabled by default.
WP-CLI Commands
For developers and system administrators:
# Check status
wp media-comments status
# Disable comments
wp media-comments disable
# Enable comments
wp media-comments enable
# Delete all comments on media (with confirmation)
wp media-comments cleanup
# Delete without confirmation
wp media-comments cleanup --yes
Usage example:
$ wp media-comments status
=== No Comments on Media - Status ===
Plugin Status: ENABLED
Attachments with open comments: 0
Total comments on attachments: 45
Success: Comments are disabled on media attachments.
🔧 Technical Details
WordPress Hooks
Plugin uses the following hooks:
comments_open- Disables ability to open commentspings_open- Disables pingbacks/trackbackscomments_array- Returns empty comment array for attachmentsinit- Removes comment support from attachment post typetemplate_redirect- Replaces comments template with blank fileadmin_init- Registers settings
What happens on activation?
- Sets default option to
enabled - Closes comments on all existing attachments
- Plugin starts working immediately
Comment Deletion
Plugin DOES NOT DELETE existing comments by default. It only hides them.
If you want to permanently delete comments:
- Via Admin: Settings → Media → check "Delete existing comments on attachments"
- Via WP-CLI:
wp media-comments cleanup --yes
⚠️ Note: This action is permanent and cannot be undone. We recommend backing up before deletion.
📦 File Structure
no-comments-on-media/
├── no-comments-on-media.php # Main plugin file (~400 lines)
├── blank.php # Blank template for comments
├── readme.txt # WordPress.org readme
└── README.md # This documentation
🎨 Performance & SEO
- ⚡ Ultra fast - Minimal overhead, only necessary hooks
- 🪶 Extremely lightweight - ~400 lines of code
- 🔍 SEO friendly - Removes unnecessary sections, faster loading
- 🎯 Zero bloat - No unnecessary features
- 🌐 Theme-agnostic - Works with any theme
📋 Requirements
- WordPress: 5.0 or newer
- PHP: 7.0 or newer
- MySQL: 5.6 or newer (WordPress standard)
❓ FAQ
Does the plugin delete existing comments?
By default NO. Plugin only hides comments. However, there is an option for permanent deletion:
- Admin: Settings → Media → "Delete existing comments on attachments"
- CLI:
wp media-comments cleanup
Does it disable trackbacks/pingbacks too?
Yes! Plugin disables both comments and trackbacks/pingbacks on all media attachments.
Does it work with my theme?
Yes! Plugin is theme-agnostic and works with all WordPress themes (custom themes, page builders, block themes).
Does it affect comments on posts/pages?
No. Plugin affects only media attachments. Comments on posts and pages are not affected.
Does it slow down the site?
No. Plugin is ultra-lightweight and uses minimal resources. No negative impact on performance.
Compatibility with caching plugins?
Yes. Compatible with all caching plugins (WP Super Cache, W3 Total Cache, WP Rocket, etc.).
Can I use the plugin via command line?
Yes! Plugin has full WP-CLI support with commands: disable, enable, cleanup, status.
Is it safe to delete comments?
Deletion is permanent and cannot be undone. Make a backup before using this option. Use only if you're sure you don't need the comments.
📄 License
GPL v2 or later - https://www.gnu.org/licenses/gpl-2.0.html
👨💻 Author
Bitwise Software
GitHub: @Bitwise-SoftwarePR
🐛 Support
For help:
- GitHub Issues: github.com/Bitwise-SoftwarePR/NoCommentsOnMedia/issues
- WordPress.org Support: wordpress.org/support/plugin/no-comments-on-media/
🤝 Contributing
Pull requests are welcome! For major changes, please open an issue first.
Development
# Clone repository
git clone https://github.com/Bitwise-SoftwarePR/NoCommentsOnMedia.git
# Install in WordPress
cp -r NoCommentsOnMedia /path/to/wordpress/wp-content/plugins/
📝 Changelog
1.0.0 - 2025-11-18
- 🎉 Initial release
- ✅ Disable comments and pingbacks/trackbacks on media attachments
- ✅ Remove comment forms and sections
- ✅ Simple ON/OFF toggle
- ✅ Optional: Delete existing comments
- ✅ WP-CLI support (disable, enable, cleanup, status)
- ✅ Auto-close existing comments on activation
Made with ❤️ for the WordPress community by Bitwise Software
No Comments on Media (Serbian)
📋 Opis
No Comments on Media je ultra-lagani plugin koji automatski isključuje komentare na svim media attachment stranicama. Bez komplikacija, bez bloat-a - samo čist, minimalan kod.
Zašto vam je potreban ovaj plugin?
Media attachment stranice (slike, videi, PDF-ovi) retko trebaju komentare. Ovaj plugin:
✅ Poboljšava SEO - Uklanja nepotrebne comment sekcije
✅ Povećava sigurnost - Smanjuje spam i potencijalne bezbednosne propuste
✅ Čisti vaš sajt - Profesionalniji izgled attachment stranica
✅ Štedi resurse - Manje database queries, brže učitavanje
✨ Funkcionalnosti
🎯 Core Features
- Automatsko isključivanje komentara - Komentari se više ne mogu dodavati na attachments
- Isključuje trackbacks/pingbacks - Potpuna zaštita od spam-a
- Uklanja Comments sekciju - Potpuno sakriva comment form i postojeće komentare
- Theme-agnostic - Radi sa bilo kojom WordPress temom
- Simple ON/OFF toggle - Jednostavna kontrola u Settings → Media
- Auto-close na aktivaciji - Pri aktivaciji zatvara komentare na svim postojećim attachmentima
🎁 Bonus Features
- Opciono brisanje komentara - Toggle za trajno brisanje postojećih komentara na attachments
- WP-CLI podrška - Profesionalne komande za developere i system admine
- Status monitoring - Prikaz trenutnog stanja komentara na media
🚀 Instalacija
Automatska instalacija (WordPress.org)
- Idite na Plugins → Add New
- Pretražite "No Comments on Media"
- Kliknite "Install Now" i zatim "Activate"
- Gotovo! Plugin radi automatski
Ručna instalacija
- Preuzmite plugin fajlove
- Otpremite folder u
/wp-content/plugins/ - Aktivirajte plugin kroz Plugins meni
- Plugin automatski počinje da radi
📖 Korišćenje
Plugin radi automatski nakon aktivacije. Za kontrolu funkcionalnosti:
Admin Panel
- Idite na Settings → Media
- Pronaćite sekciju "Comments on Media"
- Konfigurisanje opcija:
- ☑ Disable comments on all media attachments - Glavna funkcionalnost
- ☑ Delete existing comments on attachments - ⚠️ Trajno briše komentare (opciono)
- Sačuvajte promene
Plugin je omogućen po defaultu.
WP-CLI Komande
Za developere i system administratore:
# Provera statusa
wp media-comments status
# Isključivanje komentara
wp media-comments disable
# Uključivanje komentara
wp media-comments enable
# Brisanje svih komentara na media (sa potvrdom)
wp media-comments cleanup
# Brisanje bez potvrde
wp media-comments cleanup --yes
Primer korišćenja:
$ wp media-comments status
=== No Comments on Media - Status ===
Plugin Status: ENABLED
Attachments with open comments: 0
Total comments on attachments: 45
Success: Comments are disabled on media attachments.
🔧 Tehnički detalji
WordPress Hooks
Plugin koristi sledeće hookove:
comments_open- Isključuje mogućnost otvaranja komentarapings_open- Isključuje pingbacks/trackbackscomments_array- Vraća prazan array komentara za attachmentsinit- Uklanja comment support sa attachment post type-atemplate_redirect- Zamenjuje comments template sa praznim fajlomadmin_init- Registruje settings
Šta se dešava pri aktivaciji?
- Postavlja default opciju na
enabled - Zatvara komentare na svim postojećim attachmentima
- Plugin odmah počinje da radi
Brisanje komentara
Plugin NE BRIŠE postojeće komentare po defaultu. Samo ih sakriva.
Ako želite da trajno obrišete komentare:
- Via Admin: Settings → Media → čekirajte "Delete existing comments on attachments"
- Via WP-CLI:
wp media-comments cleanup --yes
⚠️ Napomena: Ova akcija je trajna i ne može se opozvati. Preporučujemo backup pre brisanja.
📦 Struktura fajlova
no-comments-on-media/
├── no-comments-on-media.php # Glavni plugin fajl (~160 linija)
├── blank.php # Prazan template za comments
├── readme.txt # WordPress.org readme
└── README.md # Ova dokumentacija
🎨 Performance & SEO
- ⚡ Ultra brz - Minimalni overhead, samo neophodni hookovi
- 🪶 Extremely lightweight - ~160 linija koda
- 🔍 SEO friendly - Uklanja nepotrebne sekcije, brže učitavanje
- 🎯 Zero bloat - Nema nepotrebnih features
- 🌐 Theme-agnostic - Radi sa bilo kojom temom
📋 Zahtevi
- WordPress: 5.0 ili noviji
- PHP: 7.0 ili noviji
- MySQL: 5.6 ili noviji (standard za WordPress)
❓ FAQ
Da li plugin briše postojeće komentare?
Po defaultu NE. Plugin samo sakriva komentare. Međutim, postoji opcija za trajno brisanje:
- Admin: Settings → Media → "Delete existing comments on attachments"
- CLI:
wp media-comments cleanup
Da li isključuje i trackbacks/pingbacks?
Da! Plugin isključuje i komentare i trackbacks/pingbacks na svim media attachmentima.
Radi li sa mojom temom?
Da! Plugin je theme-agnostic i radi sa svim WordPress temama (custom themes, page builders, block themes).
Da li utiče na komentare na posts/pages?
Ne. Plugin utiče samo na media attachments. Komentari na postovima i stranicama nisu zahvaćeni.
Da li usporava sajt?
Ne. Plugin je ultra-lagani i koristi minimalne resurse. Nema negativnog uticaja na performanse.
Kompatibilnost sa caching pluginima?
Da. Kompatibilan sa svim caching pluginima (WP Super Cache, W3 Total Cache, WP Rocket, itd).
Mogu li koristiti plugin preko command line?
Da! Plugin ima punu WP-CLI podršku sa komandama: disable, enable, cleanup, status.
Je li bezbedno brisati komentare?
Brisanje je trajno i ne može se opozvati. Napravite backup pre korišćenja ove opcije. Koristite samo ako ste sigurni da vam komentari ne trebaju.
📄 Licenca
GPL v2 ili novija - https://www.gnu.org/licenses/gpl-2.0.html
👨💻 Autor
Bitwise Software
GitHub: @Bitwise-SoftwarePR
🐛 Podrška
Za pomoć:
- GitHub Issues: github.com/Bitwise-SoftwarePR/NoCommentsOnMedia/issues
- WordPress.org Support: wordpress.org/support/plugin/no-comments-on-media/
🤝 Doprinos
Pull requests su dobrodošli! Za veće izmene, molimo prvo otvorite issue.
Development
# Clone repository
git clone https://github.com/Bitwise-SoftwarePR/NoCommentsOnMedia.git
# Install u WordPress
cp -r NoCommentsOnMedia /path/to/wordpress/wp-content/plugins/
📝 Changelog
1.0.0 - 2025-11-18
- 🎉 Initial release
- ✅ Disable comments and pingbacks/trackbacks on media attachments
- ✅ Remove comment forms and sections
- ✅ Simple ON/OFF toggle
- ✅ Optional: Delete existing comments
- ✅ WP-CLI support (disable, enable, cleanup, status)
- ✅ Auto-close existing comments on activation
Napravljen sa ❤️ za WordPress zajednicu od Bitwise Software