1

I use a custom template for some of my categories. These categories offer a comment section in which a user can reply to an comment.

The problem is, that the use (after clicking on the reply link) is redirected to the default singele-view template. Can I change the redirect target to my custom post page? Is there any hook or filter?

I had the same problem after submitting the comment, but this could be solved by adding a filter/action 'comment_post_redirect'.

Thanks for your help!

  • So you'd like to be able to reply inline? Is this template a custom page template, or is it a category archive template? Or is it a category specific category archive template? Where can we find your code? – Tom J Nowell Dec 14 '15 at 19:55
  • It's a custom template. For these categoriesI don't want to use the default single.php. So I created a template file which gets the current post over $_GET parameters (e.g. website.de/forum/?post=123). Unfortunatelly since I updated to the newest WP-version, the reply function in the comments section redirects to the default single.php (which has no comment-section) instead of redirecting to my custom template/URL. All I need, is to change the redirect path. But I don't know how^^ – Brotzka Dec 15 '15 at 7:14
  • So you're unaware of category.php or it's siblings, or the taxonomy system? This could be implemented using rewrite rule endpoints to load a different template, or custom post types – Tom J Nowell Dec 15 '15 at 21:33
  • @Brotzka are you still having an issue with this? – Ethan Jinks O'Sullivan Aug 23 '16 at 19:49
0

You could create an alternative comments template that is based off of the regular Wordpress template, and create a link in place of the "respond" button that links to your custom post.

Instead of calling

<?php comments_template(); ?>

Just call

<?php comments_template('/custom-comments.php'); ?>

Here's the Wordpress article for reference - https://codex.wordpress.org/Function_Reference/comments_template

  • I use a custom comment section (see pastebin.com/1uyZb5Gi for a detailed view). Like I said in the comment above, the problem occures since I updated to the newest version of WP (4.4). Before that update, everything worked fine. – Brotzka Dec 15 '15 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.