{"id":566,"date":"2014-04-07T06:51:47","date_gmt":"2014-04-06T20:51:47","guid":{"rendered":"http:\/\/redhotinternetmarketing.com\/blog\/?p=566"},"modified":"2017-04-28T12:30:33","modified_gmt":"2017-04-28T02:30:33","slug":"wordpress-akismet-server","status":"publish","type":"post","link":"https:\/\/redhotinternetmarketing.com\/blog\/wordpress-akismet-server\/","title":{"rendered":"WordPress + Akismet + Server"},"content":{"rendered":"<p>One of those frustrating issues that crop up when you are on a server behind a firewall is the inability to configure Akismet in WordPress.<\/p>\n<p>Instructions are simple and involve editing the <em>akismet.php<\/em> file.<\/p>\n<p>Here&#8217;s how to do this properly:<\/p>\n<p style=\"padding-left: 30px;\">You may need to modify the wp-config.php file &#8211; check with your webhost.<\/p>\n<p style=\"padding-left: 30px;\">Irrespective of the server your host is running, you will need to edit the <em>akismet.php<\/em> file as follows:<\/p>\n<p style=\"padding-left: 30px;\">1. find the following line (around line 117)<\/p>\n<p style=\"padding-left: 30px;\">2. highlight <strong>all<\/strong> of the information between<\/p>\n<blockquote style=\"padding-left: 30px;\"><p>&#8220;\/\/ Returns array with headers in $response[0] and body in $response[1]&#8221;<\/p><\/blockquote>\n<p style=\"padding-left: 30px;\">and<\/p>\n<blockquote style=\"padding-left: 30px;\"><p>&#8220;\/\/ filter handler used to return a spam result to pre_comment_approved function akismet_result_spam( $approved ) {&#8221;<\/p>\n<p>Be very careful in selecting the code &#8211; it&#8217;s easy to get that wrong! Here&#8217;s an image of the section of the akismet.php file to replace &#8211;<\/p><\/blockquote>\n<p style=\"padding-left: 30px;\">3. replace that\u00a0section with this&#8230;<\/p>\n<blockquote style=\"padding-left: 30px;\"><p>\n<em>function akismet_http_post($request, $host, $path, $port = 80, $ip=null){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 global $wp_version; $akismet_version = constant(&#8216;AKISMET_VERSION&#8217;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $args =<!--more--> array( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;method&#8217;=&gt;&#8217;POST&#8217;, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;user-agent&#8217;=&gt;&#8221;User-Agent: WordPress\/$wp_version | Akismet\/$akismet_version&#8221;, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;body&#8217;=&gt;$request \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $url = &#8220;http:\/\/&#8221;.$host.$path;<\/em><br \/>\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if( !class_exists( &#8216;WP_Http&#8217; ) ) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 include_once( ABSPATH . WPINC. &#8216;\/class-http.php&#8217; ); $http_request = new WP_Http; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $http_response = $http_request-&gt;request($url,$args); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if( is_wp_error( $http_response ) ) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $response[0] = $http_response[&#8216;headers&#8217;]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $response[1] = $http_response[&#8216;body&#8217;]; return $response; }<\/em><\/p><\/blockquote>\n<p style=\"padding-left: 30px;\">\n<p>This info is detailed at <a href=\"http:\/\/tall-paul.co.uk\/wp-akismet-plugin-behind-proxy\/\">http:\/\/tall-paul.co.uk\/wp-akismet-plugin-behind-proxy\/<\/a>.<\/p>\n<p>However, the bit missing is <strong>how much<\/strong> of the function http code is to be relaced.\u00a0 If you&#8217;re a php coder that might be fine but for those of us who can follow instructions without knowing code, we\u00a0need more specific detail.<\/p>\n<p>For those people, I hope this fuller insruction will assist.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of those frustrating issues that crop up when you are on a server behind a firewall is the inability to configure Akismet in WordPress. Instructions are simple and involve editing the akismet.php file. Here&#8217;s how to do this properly: You may need to modify the wp-config.php file &#8211; check with your webhost. Irrespective of&hellip;&nbsp;<a href=\"https:\/\/redhotinternetmarketing.com\/blog\/wordpress-akismet-server\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">WordPress + Akismet + Server<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[43,3],"tags":[],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-tools","category-wordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3M6th-98","_links":{"self":[{"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/comments?post=566"}],"version-history":[{"count":0,"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/posts\/566\/revisions"}],"wp:attachment":[{"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/media?parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/categories?post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redhotinternetmarketing.com\/blog\/wp-json\/wp\/v2\/tags?post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}