Martin Wedvich
Martin Wedvich

Reputation: 2266

WordPress Reply to comment not working

We're having some issues with getting the "Reply" function to work for comments in our WordPress site. Submitting comments in general works fine, but even though the URL I'm redirected to from the "Reply" button looks correct, it just posts it as a normal comment, and the title above the comment section is just the regular title, not the expected "Leave a Reply to...". It's a custom theme, but it's set up to support this and WordPress itself is configured to allow threaded comments down to the default 5 levels.

Here's the site in question: http//antagonist.no

What's strange about this is that it only happens in the live environment. I have a testing environment set up locally, where WordPress is configured with the exact same configuration and version of our template. The Reply function works perfectly there, with the same URL structure and parameters, and I'm unable to reproduce what's going on in the live environment.

The only differences are the hosting environments: my local testing environment runs on Apache 2.2 on OS X 10.9, while the live environment runs on IIS 6 on Windows Server 2008 R2. Both are running PHP 5.5.8. Could this be due to the URL rewriting for permalinks? WordPress does this automatically on Apache, but on IIS in the live environment we used a plugin called ISAPI_Rewrite 3 (http://www.helicontech.com/isapi_rewrite/) to support the URL rewriting, with the following rules:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?p=$1 [NC,L]

It seems to work fine for anything else than comment replies.

Any ideas for things we could check for or try?

Upvotes: 0

Views: 2984

Answers (3)

Lafif Astahdziq
Lafif Astahdziq

Reputation: 3976

Maybe you need to include javascript comments from wordpress, because wordpress use it to grab the comment id from parent comment. Try to add this to your functions.php

function add_comment_js(){
if (!is_admin()){
    if (!is_page() AND is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
      wp_enqueue_script( 'comment-reply' );
    }
  }
}
add_action('get_header', 'add_comment_js');

Upvotes: 3

Martin Wedvich
Martin Wedvich

Reputation: 2266

Changing the rewrite rules to the following (taken from the WordPress codex) fixed the issues:

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Upvotes: 0

Bud Damyanov
Bud Damyanov

Reputation: 31839

Suggestion: try to change (temporary) the permalinks structure to Default (if it is not already).

This procedure will force Wordpress to remove the rewrite code from .htaccess file. Test again and revert back the permalinks - test and if the problem occur - then this is the key.

Upvotes: 0

Related Questions