• Lorelle

    (@lorelle)


    When posting a comment on my site, I hit “sumit” and get a php error that says:

    Fatal error: Call to undefined function: wp_redirect() in /xxx/xxxx/wp-comments-post.php on line 59

    I looked in the wp-comment-post.php and the code there says:

    $location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to'];
    wp_redirect($location);

    I’ve not altered this file in any way. The comment is submitted, but people are hitting the back button and resubmitting their comments, so I’m getting double comment postings.

    Help?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    It’s a long shot, but it may be related to cookie handling. This would be the fix: http://www.avalon5.com/index.php/archives/18

    Referencing this post: http://wordpress.org/support/topic.php?id=28982#post-163575

    Thread Starter Lorelle

    (@lorelle)

    Thanks, but I’m on Apache not Windows 2000 server, and these articles refer to the Windows 2000 server. Would they still apply?

    I’ve cleared the cookies on my computer, but my users aren’t accessing cookies from my computer when they have the problems. I don’t know if WordPress uses cookies for any of the plugins or basic installation, but I don’t use cookies on my site.

    Any other ideas?

    Kafkaesqui

    (@kafkaesqui)

    wp_redirect() is a new funtion to 1.5.1, i.e. an unreleased version of WP.

    Thread Starter Lorelle

    (@lorelle)

    And so this is a bug or unfinished thing that I have to live with until finished? Thanks, Kaf.

    Kafkaesqui

    (@kafkaesqui)

    You can try changing

    wp_redirect($location);

    to:

    header("Location: ". $location);

    If you’re running 1.5, you could also reinstall wp-comment-post.php from that version.

    Thread Starter Lorelle

    (@lorelle)

    I’m using a nightly, but I just want to be clear for the crowd. If I’m using the nightly and get this error, I can copy over the wp-comment-post.php from the public released 1.5 version and it will all still work….or make the change you mentioned.

    Thanks.

    Thread Starter Lorelle

    (@lorelle)

    I just did the replacement you recommended and everything works like a charm. THANKS!!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp-comment-post.php error on $location’ is closed to new replies.