Skip to content

WordPress + Akismet + Server

    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’s how to do this properly:

    You may need to modify the wp-config.php file – check with your webhost.

    Irrespective of the server your host is running, you will need to edit the akismet.php file as follows:

    1. find the following line (around line 117)

    2. highlight all of the information between

    “// Returns array with headers in $response[0] and body in $response[1]”

    and

    “// filter handler used to return a spam result to pre_comment_approved function akismet_result_spam( $approved ) {”

    Be very careful in selecting the code – it’s easy to get that wrong! Here’s an image of the section of the akismet.php file to replace –

    3. replace that section with this…

    function akismet_http_post($request, $host, $path, $port = 80, $ip=null){         global $wp_version; $akismet_version = constant(‘AKISMET_VERSION’);         $args = array(              ‘method’=>’POST’,              ‘user-agent’=>”User-Agent: WordPress/$wp_version | Akismet/$akismet_version”,              ‘body’=>$request         );          $url = “http://”.$host.$path;
             if( !class_exists( ‘WP_Http’ ) )          include_once( ABSPATH . WPINC. ‘/class-http.php’ ); $http_request = new WP_Http;          $http_response = $http_request->request($url,$args);          if( is_wp_error( $http_response ) )               return;          $response[0] = $http_response[‘headers’];          $response[1] = $http_response[‘body’]; return $response; }

    This info is detailed at http://tall-paul.co.uk/wp-akismet-plugin-behind-proxy/.

    However, the bit missing is how much of the function http code is to be relaced.  If you’re a php coder that might be fine but for those of us who can follow instructions without knowing code, we need more specific detail.

    For those people, I hope this fuller insruction will assist.

     

     

    Discover more from Red Hot Internet Marketing

    Subscribe now to keep reading and get access to the full archive.

    Continue reading