The following column WordPress Tutorial will introduce to you how to turn on and off the WordPress article comment function in batches. I hope it will be helpful to friends in need!
#WordPress cannot turn on and off the comment function of articles in batches by default. If you want to temporarily turn off or turn on the comment function of WordPress articles, you can refer to the method in this article.
This article uses the WordPress database to operate the WPDB object ($wpdb) to perform batch operations on the comment function of the article.
Add the following code to the current theme functions.php:
Turn on the comment function of articles in batches
global $wpdb; $wpdb->query( "UPDATE wp_posts SET comment_status='open'" );
Close the comment function of articles in batches
global $wpdb; $wpdb->query( "UPDATE wp_posts SET comment_status='close'" );
After adding the code, just refresh any page of the website. Remove the code after use and do not need to keep it in the theme.
The above is the detailed content of Turn on and off the WordPress article comment function in batches. For more information, please follow other related articles on the PHP Chinese website!