Last active
August 29, 2015 14:08
-
-
Save DBasic/571b2c8f056503c1f281 to your computer and use it in GitHub Desktop.
[Wordpress] Disable Comments Programmatically
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
function example_disable_all_comments_and_pings() { | |
// Turn off comments | |
if( '' != get_option( 'default_ping_status' ) ) { | |
update_option( 'default_ping_status', '' ); | |
} // end if | |
// Turn off pings | |
if( '' != get_option( 'default_comment_status' ) ) { | |
update_option( 'default_comment_status', '' ); | |
} // end if | |
} // end example_disable_all_comments_and_pings | |
add_action( 'after_setup_theme', 'example_disable_all_comments_and_pings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment