Somewhere in your theme template is a call to the_comments_pagination()
. If you would look at the source code, you could find the declaration of that function:
function the_comments_pagination( $args = array() ) {
echo get_the_comments_pagination( $args );
}
There are two things to note here:
- This function is passing its call through to another function.
- It accepts a parameter
$args
.
Looking at the called function get_the_comments_pagination()
shows you that the markup is built using paginate_comments_links( $args )
. So the $args
are passed through again.
And in that function you can see what happens with the parameter: It is parsed against a default value.
'base' => add_query_arg( 'cpage', '%#%' ),
'format' => '',
'total' => $max_page,
'current' => $page,
'echo' => true,
'add_fragment' => '#comments'
In conclusion, you just have to change the call to the first function:
the_comments_pagination([ 'add_fragment' => '' ]);