开发者

call_user_func ... valid callback

I have practically 0 PHP knowledge. I have a wp blog, I just published my first post, and when I try to use the comments, I get the following:

Warning: call_user_func(twentyten_comment) [function.call-user-func]: First argument is expected to be a valid callback in /home/erisdesi/public_html/wp-includes开发者_StackOverflow中文版/comment-template.php on line 1308

Here's the post: http://www.erisdesigns.net/2010/08/27/make-your-own-20xx-daily-planner/

I wish I could be more helpful.


This might be due to one of the reasons:

  1. The callback method is not defined.
  2. Issue with the scope of callback method.

2nd issue can be resolved by trying to call the callback method using $this if your callback method is present in the same class where you are binding the hook with callback fuction like:

class my_sample_plugin_page 
 {
function __construct(){
    add_action('admin_menu',array( $this, 'admin_menu_call' ));
}
function admin_menu_call () {
    add_options_page( 'Page Title','Circle Tree Login','manage_options','options_page_slug', array( $this, 'settings_page' ) );
}
function  settings_page () {
    echo 'This is the page content';
}
}
new my_sample_plugin_page;

Thus in above code callback method admin_menu_call is called using $this.


That error means it's trying to call a function named twentyten_comment but that function is not defined (or if it is defined, it's not in the scope of the script).

The cause might be the theme or a plugin. Maybe try disabling plugins one-by-one to see if it fixes it?


It's an issue in comments.php within your theme. Search for this:

wp_list_comments( array( 'callback' => 'twentyten_comment' ) );

Remove the parameters, so it should look like this:

wp_list_comments();


I had the same problem and after hours of investigating, I just changed the theme and it worked! I know it's not ideal solution, but it is a quick fix, just what I needed, because I'm currently working on a wp plugin. cheers!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜