#33383 closed defect (bug) (fixed)
Comment reply links are always to first comment form on a page even when $withcomments variable is set
Reported by: | johnh10 | Owned by: | |
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.2.4 |
Component: | Comments | Keywords: | |
Focuses: | Cc: |
Description
Using $withcomments to allow comments to be displayed on main index page, clicking 'reply' to any comment on any post reloads the index page with the focus on the first post's comment form, and ALL comment forms now have 'Leave a Reply to [NAME]'.
The focus should be on the target post's comment form, and only that comment form should have 'Leave a Reply to [NAME]'.
How to reproduce:
- Clean WordPress install.
- Use default theme Twenty Twelve or another.
- Settings->Discussion : Enable threaded comments should be checked by default.
- Edit theme index page and add comment code after get_template_part function that displays the post content. For instance, index.php loop for Twenty Twelve theme:
<?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : $withcomments=1; comments_template(); endif; ?> <?php endwhile; ?>
- WordPress install should come with a 'Hello World' post. Create and approve a generic comment for this post.
- Create a new post and publish. Create and approve a generic comment for this post too.
- View the Site home page. It should show your two posts, each with a comment that shows a 'reply' link. On the last post's comment, click the 'reply' link.
- Notice it will reload the home page, but the focus will be on the comment form for the first post, not the one you are trying to leave a comment reply for.
Also notice both comment forms will display the same 'Leave a Reply to [NAME]'.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Fixed in r32786. See #31333.