Last active
August 29, 2015 14:12
-
-
Save SiGaCode/ba31bd5a46bdd89fba92 to your computer and use it in GitHub Desktop.
This snippet comes in handy if you want to disable comments on attachment pages, got lots of media already and don´t want to go through each single one (no bulk edit here unfortunately).
Credits: http://premium.wpmudev.org/blog/wordpress-comments-off/
Goes to Dynamik Custom - Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Don´t allow any comments on media attachment pages | |
function filter_media_comment_status( $open, $post_id ) { | |
$post = get_post( $post_id ); | |
if( $post->post_type == 'attachment' ) { | |
return false; | |
} | |
return $open; | |
} | |
add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment