Skip to content

Instantly share code, notes, and snippets.

@ericnicolaas
Last active February 20, 2016 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericnicolaas/2bd145e9d3ca7a293a0d to your computer and use it in GitHub Desktop.
Save ericnicolaas/2bd145e9d3ca7a293a0d to your computer and use it in GitHub Desktop.
Fix a bug in Charitable 1.3.1 that causes comments to be disabled on all post types
function ed_charitable_disable_comments( $open, $post_id ) {
/* If open is already false, just hit return. */
if ( ! $open ) {
return $open;
}
if ( charitable_is_page( 'campaign_donation_page' )
|| charitable_is_page( 'campaign_widget_page' )
|| charitable_is_page( 'donation_receipt_page' )
|| charitable_is_page( 'donation_processing_page' ) ) {
$open = false;
}
return $open;
}
function ed_charitable_fix_comments_bug() {
if ( class_exists( 'Charitable_Public' ) ) {
add_filter( 'comments_open', 'ed_charitable_disable_comments', 10, 2 );
remove_filter( 'comments_open', array( Charitable_Public::get_instance(), 'disable_comments_on_application_pages' ), 10, 2 );
}
}
add_action( 'plugins_loaded', 'ed_charitable_fix_comments_bug' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment