Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Created April 11, 2019 22:21
Show Gist options
  • Select an option

  • Save barryhughes/928e3bb39c3fda803fde0eca030038c5 to your computer and use it in GitHub Desktop.

Select an option

Save barryhughes/928e3bb39c3fda803fde0eca030038c5 to your computer and use it in GitHub Desktop.
<?php
/**
* Set the default comment status for events to 'closed'.
*
* Could easily be adapted to target all post types or a different
* post type.
*/
add_filter( 'get_default_comment_status', function( $status, $post_type ) {
if ( 'tribe_events' !== $post_type ) {
return $status;
}
return 'closed';
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment