Make WordPress Core

Changeset 60088


Ignore:
Timestamp:
03/25/2025 03:14:50 PM (10 months ago)
Author:
audrasjb
Message:

Permalinks: Revert [59966].

The original commit ignores some of the arguments that can be passed to the function, mainly base and format. Reverting for now.

Props peterwilsoncc.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r60062 r60088  
    47144714        }
    47154715        $link .= $args['add_fragment'];
    4716         $link  = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
    47174716
    47184717        $page_links[] = sprintf(
     
    47474746                }
    47484747                $link .= $args['add_fragment'];
    4749                 $link  = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
    47504748
    47514749                $page_links[] = sprintf(
     
    47724770        }
    47734771        $link .= $args['add_fragment'];
    4774         $link  = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
    47754772
    47764773        $page_links[] = sprintf(
  • trunk/tests/phpunit/tests/general/paginateLinks.php

    r59979 r60088  
    363363        $this->assertContains( "<a class=\"page-numbers\" href=\"$page_2_url\">2</a>", $links );
    364364    }
    365 
    366     /**
    367      * @ticket 61393
    368      */
    369     public function test_pagination_links_with_trailing_slash() {
    370         $this->set_permalink_structure( '/%postname%/' );
    371 
    372         $args = array(
    373             'base'      => 'http://example.org/category/test/%_%',
    374             'format'    => 'page/%#%',
    375             'total'     => 5,
    376             'current'   => 2,
    377             'prev_next' => true,
    378         );
    379 
    380         $links = paginate_links( $args );
    381 
    382         // Test page 1 link (should have trailing slash).
    383         $this->assertStringContainsString(
    384             'href="http://example.org/category/test/"',
    385             $links,
    386             'Page 1 link should have trailing slash when permalink structure has trailing slash'
    387         );
    388 
    389         // Test page 3 link (should have trailing slash).
    390         $this->assertStringContainsString(
    391             'href="http://example.org/category/test/page/3/"',
    392             $links,
    393             'Page 3 link should have trailing slash when permalink structure has trailing slash'
    394         );
    395 
    396         // Test previous link (should have trailing slash).
    397         $this->assertStringContainsString(
    398             'class="prev page-numbers" href="http://example.org/category/test/"',
    399             $links,
    400             'Previous link should have trailing slash when permalink structure has trailing slash'
    401         );
    402     }
    403 
    404     /**
    405      * @ticket 61393
    406      */
    407     public function test_pagination_links_without_trailing_slash() {
    408         $this->set_permalink_structure( '/%postname%' );
    409 
    410         $args = array(
    411             'base'      => 'http://example.org/category/test/%_%',
    412             'format'    => 'page/%#%',
    413             'total'     => 5,
    414             'current'   => 2,
    415             'prev_next' => true,
    416         );
    417 
    418         $links = paginate_links( $args );
    419 
    420         // Test page 1 link (should not have trailing slash).
    421         $this->assertStringContainsString(
    422             'href="http://example.org/category/test"',
    423             $links,
    424             'Page 1 link should not have trailing slash when permalink structure has no trailing slash'
    425         );
    426 
    427         // Test page 3 link (should not have trailing slash).
    428         $this->assertStringContainsString(
    429             'href="http://example.org/category/test/page/3"',
    430             $links,
    431             'Page 3 link should not have trailing slash when permalink structure has no trailing slash'
    432         );
    433 
    434         // Test previous link (should not have trailing slash).
    435         $this->assertStringContainsString(
    436             'class="prev page-numbers" href="http://example.org/category/test"',
    437             $links,
    438             'Previous link should not have trailing slash when permalink structure has no trailing slash'
    439         );
    440     }
    441365}
Note: See TracChangeset for help on using the changeset viewer.