Last active
February 20, 2016 01:54
-
-
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
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
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