Title: [Plugin: Antispam Bee] Spam Reason: CSS Hack
Last modified: August 19, 2016

---

# [Plugin: Antispam Bee] Spam Reason: CSS Hack

 *  [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/)
 * Since I don’t know when, all comments got deleted, including legitimate.
    Enabling
   marking as spam revealed a reason: “Spam Reason: CSS Hack”. But why? And how 
   can I fix this? Is there a conflicting plugin? My site is [http://blog.bokhorst.biz/](http://blog.bokhorst.biz/)
 * [http://wordpress.org/extend/plugins/antispam-bee/](http://wordpress.org/extend/plugins/antispam-bee/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892443)
 * I found out the comment textarea isn’t replaced as it should, but I didn’t found
   out why yet. On another similar site (same theme at least) it is just working.
 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892479)
 * Okay, I fixed the problem this way:
 * First I added a new action hook:
 * `add_filter('comment_form_field_comment', array($this, 'alt_replace_comment_field'));`
 * Below this one:
 * `add_action('template_redirect', array($this, 'replace_comment_field'));`
 * Then I added this function below ‘replace_comment_field’:
 *     ```
       function alt_replace_comment_field($field) {
       	return preg_replace("#<textarea(.*?)name=([\"\'])comment([\"\'])(.+?)</textarea>#s", "<textarea$1name=$2" .$this->md5_sign. "$3$4</textarea><textarea name=\"comment\" rows=\"1\" cols=\"1\" style=\"display:none\"></textarea>", $field, 1);
       }
       ```
   
 * I believe this solution is better and more compatible than the original one. 
   Furthermore I believe there is an error in de preg_replace in the original function.
 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892484)
 * Important note: this will only work for WordPress version 3.0 or newer.
 *  Anonymous User 166966
 * (@anonymized-166966)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892489)
 * > I believe this solution is better and more compatible than the original one.
 * See Plugin Details: Requires WordPress Version: 2.7 or higher
 * > Furthermore I believe there is an error in de preg_replace in the original 
   > function.
 * Where?
 *  Anonymous User 166966
 * (@anonymized-166966)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892495)
 * _comment\_form\_field\_comment_ is a theme specific filter. Not every theme (
   with wp 3.0) has/use it.
 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892497)
 * I was aware that the _comment\_form\_field\_comment_ filter is only available
   in WP 3.0+, but not that it is theme specific.
 * About the _preg\_replace_ error, the single quotes of this fragment should be
   replaced by double quotes:
 * `$2' .$this->md5_sign. '$3`
 *  Anonymous User 166966
 * (@anonymized-166966)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892501)
 * > but not that is is theme specific.
 * Please read: [http://devpress.com/blog/using-the-wordpress-comment-form/](http://devpress.com/blog/using-the-wordpress-comment-form/)
   
   Only if the theme supports the wordpress comment form.
 * > About the preg_replace error, the single quotes of this fragment should be 
   > replaced by double quotes:
 * Please see the code:
    `'return preg_replace("#<textarea(.*?)name=([\"\'])comment([\"\'])(.
   +?)</textarea>#s", "<textarea$1name=$2' .$this->md5_sign.`
 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892507)
 * I still think the closing quote is wrong:
 * `"<textarea$1name=$2' .$this->md5_sign.`
 * Opening quote: ” (just before <textarea)
    Closing quote: ‘ (just after $2)
 * I discovered this because I copied the _pre\_replace_ function call to my alternate
   replace function and it didn’t work correctly (the single quotes ended up in 
   the HTML).
 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892508)
 * BTW, do you have any idea why the original code didn’t replace the textarea as
   it should?
 *  Anonymous User 166966
 * (@anonymized-166966)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892509)
 * Original:
 *     ```
       create_function(
       '$input',
       'return preg_replace("#<textarea(.*?)name=([\"\'])comment([\"\'])(.+?)</textarea>#s", "<textarea$1name=$2' .$this->md5_sign. '$3$4</textarea><textarea name=\"comment\" rows=\"1\" cols=\"1\" style=\"display:none\"></textarea>", $input, 1);'
       )
       ```
   
 * Please read the manual, ok? bye.
    [http://www.php.net/manual/en/function.create-function.php](http://www.php.net/manual/en/function.create-function.php)
 *  Thread Starter [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892590)
 * Let’s break down the _preg\_replace_ of the original code:
 *     ```
       preg_replace(
       	"#<textarea(.*?)name=([\"\'])comment([\"\'])(.+?)</textarea>#s",
        	STARTING QUOTE-> "<textarea$1name=$2' <-ENDING QUOTE
       	.$this->md5_sign.
       	STARTING QUOTO-> '$3$4</textarea><textarea name=\"comment\" rows=\"1\" cols=\"1\" style=\"display:none\">
       	</textarea>", <-ENDING QUOTE
       	$input,
       	1);'
       ```
   
 * I don’t see why the documentation of _create\_function_ matters, but maybe you
   can explain it?
 * Apart from this discussion, my original problem is still not solved. Somehow,
   and I really looked hard to find out why, the comment textarea is not replaced.
   Do you have any idea about what could be wrong?

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘[Plugin: Antispam Bee] Spam Reason: CSS Hack’ is closed to new replies.

 * ![](https://ps.w.org/antispam-bee/assets/icon-256x256.png?rev=2898402)
 * [Antispam Bee](https://wordpress.org/plugins/antispam-bee/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/antispam-bee/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/antispam-bee/)
 * [Active Topics](https://wordpress.org/support/plugin/antispam-bee/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/antispam-bee/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/antispam-bee/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [M66B](https://wordpress.org/support/users/m66b/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-antispam-bee-spam-reason-css-hack/#post-1892590)
 * Status: not resolved