{"id":767,"date":"2026-02-02T06:12:19","date_gmt":"2026-02-02T06:12:19","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=767"},"modified":"2026-02-02T06:39:18","modified_gmt":"2026-02-02T06:39:18","slug":"wordpress%e6%89%b9%e9%87%8f%e5%85%b3%e9%97%ad%e6%96%87%e7%ab%a0%e7%9a%84%e8%af%84%e8%ae%ba%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=767","title":{"rendered":"wordpress\u6279\u91cf\u5173\u95ed\u6587\u7ae0\u7684\u8bc4\u8bba\u529f\u80fd"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>mysql> SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';\n\nmysql> alter table wp_posts alter column comment_status set default 'closed';\n\nmysql> SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';\n\nmysql> update wp_posts set comment_status='closed' where comment_status='open' and post_type='post' and post_status='publish';\n\nmysql> CREATE DEFINER = root EVENT `blog`.`DIS_POSTS_COMMENT` ON SCHEDULE EVERY '5' SECOND COMMENT '\u5173\u95ed\u6587\u7ae0\u8bc4\u8bba\u529f\u80fd' DO update wp_posts set comment_status='closed' where comment_status='open' and post_type='post' and post_status='publish';<\/code><\/pre>\n\n\n\n<p>\u6267\u884c\u7684\u8fd9\u51e0\u6761 MySQL \u547d\u4ee4\uff0c\u6838\u5fc3\u76ee\u7684\u662f\u5148\u8c03\u6574 SQL \u6a21\u5f0f\uff0c\u518d\u4fee\u6539 <code>wp_posts<\/code> \u8868\u4e2d <code>comment_status<\/code> \u5b57\u6bb5\u7684\u9ed8\u8ba4\u503c\u4e3a <code>closed<\/code>\uff0c\u6700\u540e\u5c06\u8be5\u8868\u4e2d\u6240\u6709 <code>post_type<\/code> \u4e3a <code>post<\/code> \u4e14 <code>comment_status<\/code> \u4e3a <code>open<\/code> \u7684\u8bb0\u5f55\uff0c\u7edf\u4e00\u628a <code>comment_status<\/code> \u66f4\u65b0\u4e3a <code>closed<\/code>\uff08\u4e5f\u5c31\u662f\u5173\u95ed\u6587\u7ae0\u7684\u8bc4\u8bba\u529f\u80fd\uff09\uff0c\u518d\u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u4e8b\u4ef6\uff0c\u6bcf\u9694 5 \u79d2\u81ea\u52a8\u5c06\u65b0\u53d1\u5e03\u7684\u3001\u8bc4\u8bba\u5904\u4e8e\u5f00\u542f\u72b6\u6001\u7684\u6587\u7ae0\u8bc4\u8bba\u5173\u95ed\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6267\u884c\u7684\u8fd9\u51e0\u6761 MySQL \u547d\u4ee4\uff0c\u6838\u5fc3\u76ee\u7684\u662f\u5148\u8c03\u6574 SQL \u6a21\u5f0f\uff0c\u518d\u4fee\u6539 wp_posts \u8868\u4e2d comment_status \u5b57\u6bb5\u7684\u9ed8\u8ba4\u503c\u4e3a closed\uff0c\u6700\u540e\u5c06\u8be5\u8868\u4e2d\u6240\u6709 post_type \u4e3a post \u4e14 comment_status \u4e3a open \u7684\u8bb0\u5f55\uff0c\u7edf\u4e00\u628a comment_status \u66f4\u65b0\u4e3a closed\uff08\u4e5f\u5c31\u662f\u5173\u95ed\u6587\u7ae0\u7684\u8bc4\u8bba\u529f\u80fd\uff09\uff0c\u518d\u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u4e8b\u4ef6\uff0c\u6bcf\u9694 5 \u79d2\u81ea\u52a8\u5c06\u65b0\u53d1\u5e03\u7684\u3001\u8bc4\u8bba\u5904\u4e8e\u5f00\u542f\u72b6\u6001\u7684\u6587\u7ae0\u8bc4\u8bba\u5173\u95ed\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-767","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=767"}],"version-history":[{"count":3,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/767\/revisions"}],"predecessor-version":[{"id":775,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/767\/revisions\/775"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}