{"id":275,"date":"2018-10-06T09:12:40","date_gmt":"2018-10-06T00:12:40","guid":{"rendered":"https:\/\/058.jp\/twentyseventeen\/?p=275"},"modified":"2018-10-18T09:19:40","modified_gmt":"2018-10-18T00:19:40","slug":"%e8%87%aa%e4%bd%9c%e3%82%b9%e3%83%91%e3%83%a0%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%83%95%e3%82%a3%e3%83%ab%e3%82%bf%e3%83%bc","status":"publish","type":"post","link":"https:\/\/058.jp\/twentyseventeen\/archives\/275","title":{"rendered":"\u81ea\u4f5c\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc"},"content":{"rendered":"<p>WordPress\u3067Web\u30b5\u30a4\u30c8\u3092\u516c\u958b\u3059\u308b\u3068\u3001\u8a18\u4e8b\u3078\u306e\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u304c\u7d50\u69cb\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u627f\u8a8d\u524d\u306e\u30b3\u30e1\u30f3\u30c8\u306a\u3089\u8868\u306b\u8868\u793a\u3055\u308c\u306a\u3044\u3068\u3057\u3066\u3082\u3001\u7ba1\u7406\u753b\u9762\u3067\u3044\u3061\u3044\u3061\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u3092\u30b4\u30df\u7bb1\u3078\u79fb\u52d5\u3067\u524a\u9664\u3059\u308b\u306e\u3082\u9762\u5012\u3067\u3059\u3002<\/p>\n<p>\u6700\u521d\u304b\u3089\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u3092\u62d2\u5426\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u304b\uff1f<\/p>\n<p><!--more--><\/p>\n<h3>\u3072\u3089\u304c\u306a\u30fb\u30ab\u30bf\u30ab\u30ca\u3092\u542b\u307e\u306a\u3044\u6642\u306b\u62d2\u5426<\/h3>\n<p>\u901a\u5e38\u306e\u65e5\u672c\u8a9e\u306e\u6587\u7ae0\u3067\u3042\u308c\u3070\u3001\u5c11\u306a\u304f\u3068\u30821\u6587\u5b57\u306f\u3072\u3089\u304c\u306a\u30fb\u30ab\u30bf\u30ab\u30ca\u3092\u542b\u3080\u306f\u305a\u3002\u3067\u3042\u308c\u3070\u3053\u308c\u3092\u6761\u4ef6\u306b\u62d2\u5426\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u6761\u4ef6\u3060\u3068\u3001\u6f22\u5b57\u3060\u3051\u306e\u30b3\u30e1\u30f3\u30c8\uff08\u4f8b\uff1a\u795d\u512a\u52dd\uff09\u3084\u3001\u9854\u6587\u5b57\uff08\u4f8b\uff1a(^-^ \uff09\u3084\u30a2\u30b9\u30ad\u30fc\u30a2\u30fc\u30c8\u3082\u62d2\u5426\u3057\u3066\u3057\u307e\u3046\u306e\u304c\u96e3\u70b9\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u554f\u984c\u306b\u306a\u3089\u306a\u3055\u305d\u3046\u3067\u3042\u308c\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092 functions.php \u304b\u81ea\u4f5c\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u8ffd\u8a18\u3059\u308b\u3068\u3001\u3072\u3089\u304c\u306a\u3001\u30ab\u30bf\u30ab\u30ca\u3092\u542b\u307e\u306a\u3044\u30b3\u30e1\u30f3\u30c8\u3001\u82f1\u6570\u5b57\u306e\u307f\u306e\u30b3\u30e1\u30f3\u30c8\u304c\u9001\u4fe1\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>\r\nadd_action('pre_comment_on_post', 'my_custome_spam_filter');\r\nfunction my_custome_spam_filter($comment_post_ID)\r\n{\r\n\t$comment = (isset($_POST['comment']) ? trim($_POST['comment']) : null);\r\n\r\n\t\/\/ \u3072\u3089\u304c\u306a\u30fb\u30ab\u30bf\u30ab\u30ca\u304c\u898b\u5f53\u305f\u3089\u306a\u3051\u308c\u3070\u62d2\u5426\r\n\tif (!preg_match('\/[\u3041-\u3093\u30a1-\u30f6\u30fc]+\/u', $comment)) {\r\n\t\twp_die('\u65e5\u672c\u8a9e\u306e\u6587\u7ae0\u3067\u306f\u306a\u3044\u3068\u5224\u5b9a\u3055\u308c\u307e\u3057\u305f\u3002');\r\n\t}\r\n}\r\n<\/pre>\n<p>\u30b3\u30e1\u30f3\u30c8\u767b\u9332\u6642\u306e\u30d5\u30c3\u30af\u306f pre_comment_on_post \u3002<\/p>\n<p>preg_match \u3067\u5224\u5b9a\u3002UTF-8\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u306e\u3067u\u30aa\u30d7\u30b7\u30e7\u30f3\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/058.jp\/twentyseventeen\/wp\/wp-content\/uploads\/2018\/10\/spam-comment.png\" alt=\"\u82f1\u6570\u5b57\u306e\u307f\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u66f8\u3044\u3066\u307f\u308b\u3068\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/058.jp\/twentyseventeen\/wp\/wp-content\/uploads\/2018\/10\/spam-comment-1.png\" alt=\"\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u306e\u62d2\u5426\u306b\u6210\u529f\u3057\u307e\u3057\u305f\"><\/p>\n<h3>URL\u3092\u591a\u6570\u542b\u3080\u5834\u5408\u3092\u62d2\u5426\u3059\u308b<\/h3>\n<p>\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u306b\u3088\u304f\u3042\u308b\u7279\u5fb4\u306b\u3001URL\u304c\u591a\u6570\u542b\u307e\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u300cURL\u591a\u3059\u304e\u300d\u3092\u6761\u4ef6\u306b\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\r\nadd_action('pre_comment_on_post', 'my_custome_spam_filter');\r\nfunction my_custome_spam_filter($comment_post_ID)\r\n{\r\n\t$comment = (isset($_POST['comment']) ? trim($_POST['comment']) : null);\r\n\r\n\t\/\/ URL\u304c5\u3064\u4ee5\u4e0a\u542b\u307e\u308c\u305f\u3089\u5374\u4e0b\r\n\tif (substr_count($comment, 'http:\/\/') + substr_count($comment, 'https:\/\/') >= 5) {\r\n\t\twp_die('URL\u304c\u591a\u3059\u304e\u307e\u3059');\r\n\t}\r\n}\r\n<\/pre>\n<p>substr_count\u95a2\u6570\u3067 http:\/\/ \u3068 https:\/\/ \u306e\u6570\u3092\u6570\u3048\u3066\u3044\u307e\u3059\u30025\u500b\u3092\u8d85\u3048\u305f\u3089\u62d2\u5426\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u500b\u6570\u306f\u81ea\u7531\u306b\u8abf\u6574\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/058.jp\/twentyseventeen\/wp\/wp-content\/uploads\/2018\/10\/spam-comment-2.png\" alt=\"URL\u3092\u5927\u91cf\u306b\u542b\u3080\u30b3\u30e1\u30f3\u30c8\u3092\u66f8\u3044\u3066\u307f\u308b\u3068\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/058.jp\/twentyseventeen\/wp\/wp-content\/uploads\/2018\/10\/spam-comment-3.png\" alt=\"URL\u3092\u5927\u91cf\u306b\u542b\u3080\u30b3\u30e1\u30f3\u30c8\u306e\u62d2\u5426\u306b\u6210\u529f\u3057\u307e\u3057\u305f\"><\/p>\n<h3>\u3055\u3089\u306b\u51dd\u3063\u305f\u3053\u3068\u3092\u3059\u308b\u3068<\/h3>\n<p>NG\u30ef\u30fc\u30c9\u306a\u3069\u3042\u308c\u3070\u3001\u300c\u30b3\u30e1\u30f3\u30c8\u306b\u25cb\u25cb\u3092\u542b\u3080\u5834\u5408\u306f\u62d2\u5426\u300d\u3068\u3044\u3063\u305f\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u3067Web\u30b5\u30a4\u30c8\u3092\u516c\u958b\u3059\u308b\u3068\u3001\u8a18\u4e8b\u3078\u306e\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u304c\u7d50\u69cb\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002 \u627f\u8a8d\u524d\u306e\u30b3\u30e1\u30f3\u30c8\u306a\u3089\u8868\u306b\u8868\u793a\u3055\u308c\u306a\u3044\u3068\u3057\u3066\u3082\u3001\u7ba1\u7406\u753b\u9762\u3067\u3044\u3061\u3044\u3061\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u3092\u30b4\u30df\u7bb1\u3078\u79fb\u52d5\u3067\u524a\u9664\u3059\u308b\u306e\u3082\u9762\u5012\u3067\u3059\u3002 \u6700\u521d\u304b &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/058.jp\/twentyseventeen\/archives\/275\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u81ea\u4f5c\u30b9\u30d1\u30e0\u30b3\u30e1\u30f3\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-275","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-plugins","category-operation"],"_links":{"self":[{"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/posts\/275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/comments?post=275"}],"version-history":[{"count":6,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/posts\/275\/revisions"}],"predecessor-version":[{"id":445,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/posts\/275\/revisions\/445"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/media\/277"}],"wp:attachment":[{"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/media?parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/categories?post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/058.jp\/twentyseventeen\/wp-json\/wp\/v2\/tags?post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}