Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#52057 closed defect (bug) (duplicate)

Small bug in pagination function paginate_links()

Reported by: kaderavek's profile kaderavek Owned by:
Milestone: Priority: normal
Severity: trivial Version: 2.1
Component: Permalinks Keywords:
Focuses: Cc:



we use on our site custom permalink structure - /%postname%-t%post_id% and we don't have / on end of url.

When we use function paginate_links for categories there are all urls ok except of first one - when you are e.g. there:
then all pagination links are ok (we add custom fragment but in not works if is without it too)
BUt the first link is with / in the end and this generate redirect which we don't want.

Can you fix it please?


Change History (11)

This ticket was mentioned in Slack in #core by lukecarbis. View the logs.

4 years ago

#2 @lukecarbis
4 years ago

@kaderavek I'd love to help replicate this problem – could you post your template code so I could give it a shot?

#3 @hellofromTonya
4 years ago

  • Keywords needs-patch removed
  • Version changed from 5.6 to 2.1

Hello @kaderavek,

Welcome to WordPress Trac! Thanks for the ticket.

I'm sorry to hear you are having issues with your website. More information will help us to investigate and advise.

There are filters in the paginate_links function. It's possible a third party plugin or theme is filtering to cause the problem. Let's check.

  • Please disable all plugins and switch to a default theme such as Twenty Twenty-One.
  • Apply your template code.
  • Does the issue still happen?

If yes, please provide us with your template code. Why? This will help us to reproduce the problem.

A few other housekeeping notes:

  • Removing 5.6 as the Version. Why? 5.6 did not make functional changes to paginate_links function.
  • Changing the Version to the function's initial version until we get more information.
  • Removing needs-patch. Why? At this stage, we need to understand and reproduce the problem to determine if this is due to Core.

#4 @kaderavek
4 years ago

Hello @hellofromTonya @lukecarbis

I try i with all plugins deactivated with theme Twenty Twenty-One 1.1 with no modification and the problem is still here.

#5 @lukecarbis
4 years ago

@kaderavek Could you please post your template code?

#6 @kaderavek
4 years ago

@lukecarbis template is archive.php

 * The template for displaying archive pages
 * @link
 * @package WordPress
 * @subpackage Twenty_Twenty_One
 * @since Twenty Twenty-One 1.0


$description = get_the_archive_description();

<?php if ( have_posts() ) : ?>

        <header class="page-header alignwide">
                <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?>
                <?php if ( $description ) : ?>
                        <div class="archive-description"><?php echo wp_kses_post( wpautop( $description ) ); ?></div>
                <?php endif; ?>
        </header><!-- .page-header -->

        <?php while ( have_posts() ) : ?>
                <?php the_post(); ?>
                <?php get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) ); ?>
        <?php endwhile; ?>

        <?php twenty_twenty_one_the_posts_navigation(); ?>

<?php else : ?>
        <?php get_template_part( 'template-parts/content/content-none' ); ?>
<?php endif; ?>

<?php get_footer(); ?>

in function twenty_twenty_one_the_posts_navigation(); which use: the_posts_pagination();
which use: get_the_posts_pagination(); which use: paginate_links();

#7 @sabernhardt
4 years ago

Similar/possibly related: #44513 (issues with first page)

#8 @kaderavek
4 years ago

@sabernhardt no, its no related (but it is in same function)

#9 follow-up: @thornsteps
4 years ago

The bug is similar to #51662. I found it on 2 months ago. At first, we don't have this bug until one day we did SEO auditing again and found it.

#10 in reply to: ↑ 9 @kaderavek
4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Yes, its the same bug

Replying to thornsteps:

The bug is similar to #51662. I found it on 2 months ago. At first, we don't have this bug until one day we did SEO auditing again and found it.

#11 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.