WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#34110 new defect (bug)

WordPress Trackback Bug when Comment Pagination is Enabled

Reported by: isaumya Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Comments Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

Hi, I just find a comment bug with wordpress which I think is there for a ling site, may be since v2.7+ but never actually fixed.

Bug Details/ Reproduce process

Inside your theme while fetching your comments after

have_comments()

try to fetch comments only by using

wp_list_comments( array( "type" => "comment") )

and then below check if trackback exists and if they do print the trackbacks separately using

wp_list_comments( array( "type" => "pings") )

Now add a bunch of comments on any of your blog post which also have some trackbacks. Add more than 60 - 70 comments on that post. and from settings enable comment pagination option. So that comments get divided into several comment pages. If you are thinking this is never going to happen in real life, let me tell you I have blog posts which has more than 2.500 comments in it and none of them are spam comments.

Now, after you enable the comment pagination, visit your blog page link i.e. example.com/some-post/ and you will see the trackbacks below your comments as it should show up now start navigation through your comment pagination, you will see the following -

Trackback is showing on the normal blog post link Trackbacks also showing for /comment-page-1/

But when you will move further from comment page 1 you will only see the heading i.e. Trackback or whatever you have set, but not the actual trackbacks. This problem is also present in genesis theme, earlier I though it was a genesis bug but while developing a non genesis wordpress there I understood that it is actually a wordpress core bug.

Change History (15)

This ticket was mentioned in Slack in #core-comments by rachelbaker. View the logs.


2 years ago

#2 follow-up: @samuelsidler
2 years ago

  • Milestone changed from Awaiting Review to Future Release

(See above-linked Slack conversation.)

#3 in reply to: ↑ 2 @isaumya
2 years ago

Replying to samuelsidler:

(See above-linked Slack conversation.)

Thank you for looking into it after 8 months. Hope this issue to be fixed soon.

#4 follow-up: @rachelbaker
2 years ago

  • Keywords reporter-feedback added
  • Milestone changed from Future Release to Awaiting Review

@isaumya Greetings, and thanks for the ticket. I understand you filed this ticket some time ago, but I hoping you can provide some more information.

It sounds as though the global $current_comment is getting corrupted because you are outputting the results of wp_list_comments() twice within the have_comments() check. Can you share the code you are using in your comments.php template file? I am particularly curious about how and where exactly you are placing the comment pagination.

#5 in reply to: ↑ 4 ; follow-up: @isaumya
2 years ago

Replying to rachelbaker:

@isaumya Greetings, and thanks for the ticket. I understand you filed this ticket some time ago, but I hoping you can provide some more information.

It sounds as though the global $current_comment is getting corrupted because you are outputting the results of wp_list_comments() twice within the have_comments() check. Can you share the code you are using in your comments.php template file? I am particularly curious about how and where exactly you are placing the comment pagination.

Hi, Thanks for your reply. I would be more than happy to share my code with you guys. I'm pasting it below. Also if you want I can give you some of my article links where you can see the problems happening live (still now). But I'm not posting those links in this comment now because I'm not sure that is allowed as per your bug reporting rule. So if you tell me, will share some of my comments in my next comment. For now, here is the code og my comments.php page

<?php
/*
 * If the current post is protected by a password and
 * the visitor has not yet entered the password we will
 * return early without loading the comments.
 */
if ( post_password_required() )
        return;
?>

<div class="comments-section <?php if ( '0' == get_comments_number() ) { echo "no-comments"; } ?>">
        <div id="comments">
                <div class="comments-wrap">
                        <?php if ( have_comments() ) : ?>
                                <?php do_action( 'new_comments_section_title' ); ?>
                        <?php endif; ?>

                        <ol class="commentlist">
                                <?php wp_list_comments( array( "callback" => "checkout_comment", "type" => "comment") ); ?>
                        </ol>

                        <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
                                <nav id="comment-nav-below" role="navigation">
                                        <?php paginate_comments_links(); ?> 
                                </nav>
                        <?php endif; // check for comment navigation ?>

                        <?php if ( ! comments_open() && get_comments_number() ) : ?>
                                <?php if( is_singular( 'download' ) ) : ?>
                                        <p class="no-comments"><?php _e( 'Only a buyer can review the product.' , 'checkout' ); ?></p>
                                <?php else : ?>
                                        <p class="no-comments"><?php _e( 'Comments are closed.' , 'checkout' ); ?></p>
                                <?php endif; ?>
                        <?php endif; ?>

                        <?php $trackback_count =  get_comments( array(
                                                                                                        'status' => 'approve',
                                                                                                        'post_id'=> get_the_ID(), 
                                                                                                        'type'=> 'pings', 
                                                                                                        'count' => true)
                                                                                                 );
                        if ( $trackback_count > 0 ) : ?>
                                <hr class="hrdesign" />
                                <h3 id="comments-title" class="trackback-heading"><?php printf( _nx( '1 mention so far', '%1$s mentions so far', $trackback_count, 'comments title', 'checkout' ), number_format_i18n( $trackback_count ) ); ?></h3>
                                <ol class="commentlist">
                                        <?php wp_list_comments( array( "callback" => "checkout_comment", "type" => "pings", "reply_text" => null, "format" => "html5") ); ?>
                                </ol>
                        <?php endif; ?>

                        <?php //$form_args = array( 'title_reply' => '' ); ?>

                        <?php
                                if( is_singular( 'download' ) ) {
                                        comment_form( array( 'title_reply' => 'Share your review', 'label_submit' => 'Post my review' ) );
                                } else {
                                        comment_form( array( 'title_reply' => 'Share your thoughts', 'label_submit' => 'Post my thoughts' ) );
                                }
                        ?>
                </div><!-- .comments-wrap -->
        </div><!-- #comments -->
</div><!-- .comments-section -->

P.S.: One of the thing that I'm really surprised to see is that Genesis have been using this comment & ping dividation for years now (though I'm not using it on my site) and it is a very popular framework which also has the same problem (I've tested) as this is a WordPress core issue, but no one has reported this. Very wired!

Anyways, thanks a lot for looking into this.

#6 in reply to: ↑ 5 @moonomo
2 years ago

Replying to isaumya:

P.S.: One of the thing that I'm really surprised to see is that Genesis have been using this comment & ping dividation for years now (though I'm not using it on my site) and it is a very popular framework which also has the same problem (I've tested) as this is a WordPress core issue, but no one has reported this. Very wired!

I hit to the bug, too when separating Comments and Tracback w/ Pagination enabled. And found this ticket so following since.

Would love to see this fixes w/ next release!

#7 @isaumya
2 years ago

@rachelbaker Any update on this issue?

This ticket was mentioned in Slack in #core-comments by rachelbaker. View the logs.


2 years ago

#9 follow-up: @rachelbaker
2 years ago

  • Keywords needs-patch needs-unit-tests added; reporter-feedback removed

@isaumya The pagination functions for comments weren't built to handle multiple comment loops that require pagination on the same screen. Adding support for different comment loops would require extensive changes to the current comment pagination and permalink functions.

#10 in reply to: ↑ 9 @isaumya
2 years ago

Replying to rachelbaker:

@isaumya The pagination functions for comments weren't built to handle multiple comment loops that require pagination on the same screen. Adding support for different comment loops would require extensive changes to the current comment pagination and permalink functions.

OK, so are you gonna add this in the upcoming version of WordPress?

Last edited 2 years ago by isaumya (previous) (diff)

This ticket was mentioned in Slack in #core-comments by rachelbaker. View the logs.


2 years ago

#12 follow-up: @rachelbaker
2 years ago

@isaumya This will likely be fixed at some point, but it will not be in the next couple of versions because the issue in this ticket is symptom of the architecture and functionality of comments within WordPress. Doing a second comment loop right now isn't something WordPress core supports, and would require completely custom code.

Related #35214

#13 in reply to: ↑ 12 @isaumya
2 years ago

Replying to rachelbaker:

@isaumya This will likely be fixed at some point, but it will not be in the next couple of versions because the issue in this ticket is symptom of the architecture and functionality of comments within WordPress. Doing a second comment loop right now isn't something WordPress core supports, and would require completely custom code.

Related #35214

So, what you are saying is that there is no ETA when this is going to be fixed right? May take few months or may be years....

#14 @rachelbaker
2 years ago

  • Milestone changed from Awaiting Review to Future Release

#15 @rachelbaker
2 years ago

  • Version 4.3.1 deleted
Note: See TracTickets for help on using tickets.