Family Encyclopedia >> Electronics

How to disable comments on WordPress Media attachments

We recently released a plugin that allows you to add a beautiful gallery carousel in WordPress without Jetpack. One of the features of that plugin is that it turns your gallery into a full-screen immersive experience with navigation, comments, etc. One of our users asked us if there was a way to remove the comment feature from those attachments. In this article, we will show you how to disable comments on WordPress attachments.

Paste the following code into your theme's functions.php file or a site-specific plugin.

 función filter_media_comment_status ($ open, $ post_id) $ post = get_post ($ post_id); if ($ post-> post_type == 'archivo adjunto') return false; devuelve $ abierto; add_filter ('comments_open', 'filter_media_comment_status', 10, 2); 

If you don't like dealing with code, just download the plugin called Disable Comments. This plugin allows you to globally disable comments on a specific post type such as (Post, Pages, Media). Just select the media option.

We hope you found this article useful.