duangao7133 2018-07-20 14:17
浏览 37
已采纳

在wordpress评论部分没有表格标签

-- 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:

  • checked that comments are enabled in the settings page and on specific posts
  • tried adding a form manually around comments_template() but it gets removed
  • made sure that comments_template() is called inside the loop
  • checked i'm calling comment_form() correctly
  • turned off all plugins and still not working

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 -->
  • 写回答

1条回答 默认 最新

  • duanmiaosi0150 2018-07-20 21:38
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计