Created
June 21, 2019 08:53
-
-
Save 1naveengiri/3353873b88fb5d9e1f44e74653c8dc69 to your computer and use it in GitHub Desktop.
Disable comment for CPT
This file contains hidden or 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
<?php | |
function wpgeodir_prefix_comments_open( $open, $post_id ) { | |
$post_type = get_post_type( $post_id ); | |
// allow comments for built-in "post" post type | |
if ( 'gd_compt_coaching' === $post_type ) { | |
return false; | |
} | |
// disable comments for any other post types | |
return true; | |
} | |
add_filter( 'comments_open', 'wpgeodir_prefix_comments_open', 10 , 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment