I've been struggling with a warning message above the comments field on a site I'm building for a friend and I'd be very grateful if you're able to help. I've asked on the Wordpress Codex, but unfortunately there's been no response.

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'tl_spam_free_wordpress_comments_form' was given in /home/euanmitc/public_html/wp-includes/plugin.php on line 405

I've attempted to comment out the offending line in the plugin.php

I have also deactivate all plugins with no success.

You can see an example here: http://euanmitchell.com.au/2012/05/future-education/

The site uses a Thesis theme. Please let me know if you have an ideas for possible solutions.

Best regards,

Les Thomas


Given the error message:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'tl_spam_free_wordpress_comments_form' was given in /home/euanmitc/public_html/wp-includes/plugin.php on line 403

The error is being generated by whatever Plugin defines this function:


...which appears to be Spam Free WordPress Comments.

This bit:

First argument is expected to be a valid callback

...generally refers to an add_action() or add_filter() call. For some reason, WordPress doesn't recognize tl_spam_free_wordpress_comments_form() as a valid callback - which means that WordPress isn't finding it as a declared (defined) function.

Do you have the Spam Free Plugin activated?


It's always best to start with the WordPress support forum, or the plugin author's plugin page, with a support question.

If you had mentioned on my plugin support page that the theme being used was Thesis I would have been able to answer your question sooner, rather than stumbling upon your more detailed question here.

Go back and read the plugin page under the section Thesis Theme. It says "Go to Thesis -> Custom File Editor, choose custom_functions.php, then click Edit selected file. Add the following line of code to that file:"

add_action('thesis_hook_comment_field', 'tl_spam_free_wordpress_comments_form');

Building on what Chip said, the error occurred because you deactivated the plugin without removing the add_action line above from the custom_functions.php file first.


I ran into this problem using the Captcha plug-in in conjunction with the Business Directory plug-in on Weaver II theme. My solution, as rough as it is, was to require users to register and be logged in to comment. That seems to eliminate the error without having to edit the programming.

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