Wordpress wp_update_comment function not working

2019-09-06 21:42发布

问题:

I've created a custom comment editor and for some reason, wp_update_comment is not working. It returns 1, which means it should have been successful but it's not actually updating anything. Listed below is my update code. It's important to note that I've double checked that the proper data is being added to $commentarr from the form POST.

$commentarr = array();
$commentarr['comment_ID'] = $comment_ID;
$commentarr['comment_content'] = $commentContent;
$update_success = wp_update_comment($commentarr);

    if ($update_success == 1) {
        $comment = get_comment($comment_ID);
        $article_link = get_permalink($comment->comment_post_ID);
        wp_redirect( $article_link );
    }

    else {
        $commentError = 'Something went wrong while updating your comment.';
        $hasError = true;
    }

**UPDATE** So after hacking away at the core, it turns out the error happens when....

do_action('edit_comment', $comment_ID);

...is called. Not sure if there's a plugin that's hooked into the edit_comment action or what but that's my guess at this point.

UPDATE #2

So the problem is DEFINITELY a BuddyPress issue. Tracked the problem to the file

bp-blogs/bp-blogs-functions.php

Going through the code now to see what the issue is but if I disable their add_action hook, I don't have any problems editing comments.