评论回复适用于本地,但不适用于生产



所以我可以在local上回复评论,但在live上不起作用。我可以通过管理面板回复,但当我在一个页面上点击回复评论时,它不起作用。

我检查了代码,似乎回复按钮的href呈现方式不同。

这就是它在localhost 上的样子

<a rel="nofollow" class="comment-reply-link" href="http://localhost:8888/foobar/?replytocom=1285#respond" data-commentid="1285" data-postid="7086" data-belowelement="comment-1285" data-respondelement="respond" data-replyto="Reply to foobar" aria-label="Reply to arsd">Reply</a>

这就是它在生产上的样子

<a rel="nofollow" class="comment-reply-link" href="#comment-1285" data-commentid="1285" data-postid="7086" data-belowelement="comment-1285" data-respondelement="respond" data-replyto="Reply to Alex Kwa" aria-label="Reply to foobar">Reply</a>

我认为这可能是一个插件,永久链接或htaccess问题。

  • 我没有任何插件可以触及评论
  • 我的永久链接是自定义的,但在可能的情况下,我不想因为SEO的影响而改变它
  • 我的htaccess是这样的
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 
<ifModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
SetEnv MAGICK_THREAD_LIMIT 1

任何帮助都会非常感激。

我知道我说过这似乎不是插件的问题,但我发现问题实际上是一个插件Yoast SEO的问题。类似的问题可以在这里找到。

我已经通过禁用将replytocom替换为comment的特定函数来修复它,并将其包含在我的函数中。php

add_filter( 'wpseo_remove_reply_to_com', '__return_false' );

请注意,这并不能解决问题,但根据Yoast SEO的说法,这是一个主题的问题,这些主题在回复时会将你滚动到评论输入表单,这样他们就不会自行修复。

最新更新