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 the default comments template. When I send a comment I get the following error message:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_set_comment_cookies' not found or invalid function name in /home/mattator/public_html/wp-includes/plugin.php on line 403

Warning: Cannot modify header information - headers already sent by (output started at /home/mattator/public_html/wp-includes/plugin.php:403) in /home/mattator/public_html/wp-includes/pluggable.php on line 881

couldn't find a call to the funciton 'wp_set_comment_cookies' anywhere in the code. It is noteworthy that despite the error message the comment is being sent properly. Any ideas would be appreciated.

share|improve this question
What Theme are you using? What Plugins are active? – Chip Bennett Aug 20 '12 at 16:25
I'm using my own self-built theme. I am using the native WP comments template. Turned off all plugins and the problem still persists. – Matanya Aug 27 '12 at 9:41
What "native WP comments template" are you using? – Chip Bennett Aug 27 '12 at 13:15
I'm using the "comments_template()" function with no additional parameters, which loads the default "comments.php" from the wp-includes library. codex.wordpress.org/Function_Reference/comments_template – Matanya Aug 27 '12 at 15:56

I'm using the "comments_template()" function with no additional parameters, which loads the default "comments.php" from the wp-includes library.

That's your problem.

The compat version is unmaintained and obsolete. Theme-compat files are officially no longer supported, as of WordPress 3.0. (See here.)

You need to define and include comments.php in your Theme.

share|improve this answer
Thanks. Does that mean that I have to create the whole comment system from scratch, or is there a more up-to-date file I can refer to? – Matanya Aug 28 '12 at 8:17
I tried the twentyeleven comments template and got the same error – Matanya Aug 28 '12 at 8:45
Exactly the same error? Can we see relevant code? Your comments.php, relevant parts of functions.php, and template file(s) where you call comments_template()? – Chip Bennett Aug 28 '12 at 13:24
up vote 0 down vote accepted

Well, I experimented a little bit, and as turns out the problem was a call to the function "nocache_headers()", in Line 18 of the file "wp-comments-post.php" which lies at WP root directory.
I deleted it, and voila, everything works. Not sure why though.

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.