Steps
-
Add the PHP code to your theme’s
functions.phpfile or a PHP snippets plugin. -
Save and activate the snippet.
-
New posts will have comments and pingbacks disabled by default.
/**
* Disable comments and pingbacks for new posts
*/
function custom_disable_comments_for_new_posts() {
update_option( 'default_comment_status', 'closed' );
update_option( 'default_ping_status', 'closed' );
}
add_action( 'admin_init', 'custom_disable_comments_for_new_posts' );
Tested on
WordPress 6.8
Reported by the author on November 3, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.4. It may still work.
