Support » Fixing WordPress » AJAX Comment Delete Not Working – Comments Reappear

  • ShaolinTiger

    (@shaolintiger)


    I have a strange problem, when I delete a comment from the admin panel via the delete button, the confirmation pop-up appears, so I click OK.

    Then the comment turns red and disappears, as usual and expected.

    But then after half a second or so, it just comes back, it reappears the same way it disappeared, but the cell is still red.

    After refreshing the comments page (edit-comments.php) it shows the comment is still there and wasn’t deleted.

    Has anyone encountered this before?

    It’s a bit annoying, I can still delete via mass delete but it’s not as convenient as deleting via the main page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • MichaelH

    (@michaelh)

    Any plugins that might be tripping you up?

    ShaolinTiger

    (@shaolintiger)

    Hi, I found the solution to my problem here:

    http://wordpress.org/support/topic/103953

    It’s to do with AJAX referal checking.

    It was fixable by replacing the code

    `$cookie = explode(‘; ‘, urldecode(empty($_POST[‘cookie’]) ? $_GET[‘cookie’] : $_POST[‘cookie’])); // AJAX scripts must pass cookie=document.cookie
    foreach ( $cookie as $tasty ) {
    if ( false !== strpos($tasty, USER_COOKIE) )
    $user = substr(strstr($tasty, ‘=’), 1);
    if ( false !== strpos($tasty, PASS_COOKIE) )
    $pass = substr(strstr($tasty, ‘=’), 1);
    }`

    with simply

    ` $user = $_COOKIE[USER_COOKIE];
    $pass = $_COOKIE[PASS_COOKIE];`

    This is in wp-includes/pluggable.php (in the function check_ajax_referer).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘AJAX Comment Delete Not Working – Comments Reappear’ is closed to new replies.