phpwordpresscustom-theme

no form tag in wordpress comments section


-- wordpress comments section not submitting comment --

I'm adding a comment section at the end of my single.php by calling comments_template(). The comments section loads fine and even shows posts that I've added manually in the admin section.

BUT when I try to submit a post it redirects to front_page.php and the form parameters are added to the url.

I think the problem is that there is no form tag surrounding the comments section in the HTML but I don't know why that is happening.

Things I have done:

There was a problem previously where I couldn't access the discussion settings in the admin section, this is now rectified so I don't know if it is related.

<?php /*

    comments.php

*/

if ( post_password_required() ) {
    return;
}

?>
<?php
// Do not delete these lines
        if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
        die ('Please do not load this page directly. Thanks!');
        ?>
<div id="comments" class="comments-area">
    <?php comment_form(); ?>
</div><!--  .comments-area -->

Solution

  • I had an unclosed hidden form tag in an included file. Thought I'd checked all the included files.