WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using WordPress comments as a "chat". Not real time chat, it's more like comments with more flow.

But when 4-5 or more members are using coments at the same time, I get this message:

enter image description here

Not sure why this happens or if its because more than one user is using it at the same time.

Is there anyone here who had the same problem or could lead me in the right direction?

share|improve this question
up vote 1 down vote accepted

I found a soloution and what causes it. It was not really the delimiter that was the problem it was becasue a user made duplicate posts.

Solution: Replace

$notify_message .=  preg_replace('#[\s]+#', ' ',sprintf(    get_comment_meta($comment->comment_ID, 'title',1))) .' skrev:'. "\r\n" .       $comment->comment_content . "\r\n\r\n";


$notify_message =  preg_replace('/[\s]+/', ' ',sprintf( get_comment_meta($comment->comment_ID, 'title',1)) .' skrev:'. "\r\n" . $comment->comment_content . "\r\n\r\n");

And add following code to function.php in your theme, that will allow same user to make dubplacte post:

    add_filter( 'wp_die_handler', 'my_wp_die_handler_function', 9 ); //9 means         you        can unhook the default before it fires

    function my_wp_die_handler_function($function) {
return 'my_skip_dupes_function'; //use our "die" handler instead (where we won't die)

   //check to make sure we're only filtering out die requests for the "Duplicate"     error we care about
    function my_skip_dupes_function( $message, $title, $args ) {
if (strpos( $message, 'Duplicate comment detected' ) === 0 ) { //make sure we only        prevent death on the $dupe check
   remove_filter( 'wp_die_handler', '_default_wp_die_handler' ); //don't die
   return; //nothing will happen
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.