Submitting comments gets a 404 error - Help! (6 posts)

  1. jessicacroome
    Posted 5 years ago #

    Hi there,

    Am completing the 'wordpress for designers' webcasts from themeforest...and although they're excellent I can't resolve the issues from day 9.

    Basically, my code is the same as the screencast, but when I try to submit a comment I get a 404 error!

    Help! New to wordpress and tried everything I can think of!

    My comments.php code is below:

    Much thanks in advance.
    - Jess

    if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])){
    die('Please do not load this page directly!');
    <p>This post is password protected.</p>
    <?php return; } ?>

    //Display the comment loop
    if(have_comments()) :
    <h2><?php comments_number('Be the first to comment!', 'One Comment', '% Comments'); ?></h2>
    <ol id='comments_section'>
    <?php wp_list_comments(array('avatar_size'=>80, 'reply_text'=>'Reply to this comment.')); ?>

    <div><?php paginate_comments_links(); ?></div>
    else ://If no comments so far

    <?php if('open' == $post->comment_status) : ?>
    <p>Have your say!</p>
    <?php else :?>
    <p>Comments currently closed!</p>
    <?php endif;?>
    <?php endif; ?>
    <?php if('open' == $post->comment_status) : ?>

    <div id='respond'>
    <h2><?php comment_form_title(); ?></h2>

    <div id='cancel-comment-reply'>
    <small><?php cancel_comment_reply_link(); ?></small>

    <?php if(get_option('comment_registration') && !$user_ID): ?>
    <p>You must be logged in to comment</p>
    <?php else : ?>
    <form action="<?php echo get_option('site_url'); ?>/wp-comments-post.php" method="post" id="commentform">

    <?php if($user_ID) :?>
    <p>Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?></p>

    <?php else : ?>
    <p><input type='text' name='author' id='author' value="<?php echo $comment_author;?>" />
    <label for='author'>Name</label></p>
    <p><input type='text' name='email' id='email' value="<?php echo $comment_author_email;?>" />
    <label for='email'>Mail <?php if($req) echo '(Required field)';?></label>
    <input type='text' name='url' id='url' value="<?php echo $comment_author_url; ?>" />
    <label for='url'>Website</label>
    <?php endif; ?>
    <div><?php comment_id_fields(); ?>
    <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>" />

    <p><textarea id='comment' name='comment' cols='50' rows='10'></textarea></p>

    <?php if(get_option('comment_moderation') == '1'){ ?>
    <p>Comment moderation is enabled, no need to resubmit any comments posted.</p>
    <?php } ?>

    <p><input type='submit' name='submit' id='submit' value='Submit' /></p>
    <?php do_action('comment_form', $post->ID); ?>
    <?php endif; ?>
    <?php endif; ?>

  2. LCrockett
    Posted 5 years ago #

    I am having this problem too- did you ever figure it out? Any help would be appreciated!!!!

  3. Anton
    Posted 5 years ago #

    I am experiencing the same issue. Please advise!

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 5 years ago #

    a link to your sites would help, as its probably nothing to do with the code.

    Frequently its a permalinks problem

  5. Anton
    Posted 5 years ago #

    Hello Rvoodoo,

    Thanks for your reply.
    I disabled comments for my actual posts, but on old posts you can see what I mean:

    If you leave a comment on that post, the 404 error will occur.

  6. Anton
    Posted 5 years ago #

    The problem has finally been solved. The solution was very simple. Go to settings of your comments and disable (uncheck) "break comments into pages".
    Thanks to http://www.wphulp.nl/forum/

Topic Closed

This topic has been closed to new replies.

About this Topic