Support » Fixing WordPress » How to redirect to the comment form after error

  • Hi,

    i use twentyeleven child theme, wp 3.4.2

    I made a custom error page for validation error of the comment form (instead of wp-comments-post.php… tutoriel here). Now, i would like to add the link which redirects the visitor to the comment form to be able to correct his/her fault.

    How can i do it ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Use wp_get_referer to make a link which the user can click to take them back to the previous page.

    Thanks, i will look at it. I do not know too much about php, hopefully it helps 🙂

    I tried to place the code <?php wp_get_referer() ?> in the body but it does not work :

    <?php get_header(); ?>
    <div id="primary">
    		<div id="content" role="main">
    				<div class="entry-content">
                                    <?php echo $message; ?>
    		                <?php wp_get_referer() ?>
    <?php get_footer(); ?>

    Can someone explain how i can place a link redirecting to the referring page ?


    <?php if(wp_get_referer()){ ?><a href="<?php echo wp_get_referer(); ?>" title="Go back">Go back</a>
    <?php } ?>

    YOU ARE GENIOUS !!! 🙂 , it works…

    I am asking myself why WP did not think about it, it is evident that when i make a mistake on the form, i go back to retry…

    Thanks a lot again !

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to redirect to the comment form after error’ is closed to new replies.