extended-cpts icon indicating copy to clipboard operation
extended-cpts copied to clipboard

Incorrect rewrite rule tests generated for certain permastructs

Open johnbillion opened this issue 10 years ago • 0 comments

Seems to affect permastructs which use something other than the post type slug as a prefix. Needs investigating further.

Example:

register_extended_post_type( 'foo', array(
    'rewrite' => array(
        'permastruct' => '/bar/%foo%/%post_id%'
    ),
) );

Two of the generated tests fail:

Rewrite Test: index.php?foo=$matches[1]&paged=$matches[2]
Rewrite Result: index.php?foo=$matches[1]&p=$matches[2]&page=$matches[3]
Matched: bar/(.+?)/([0-9]+)(/[0-9]+)?/?$

Rewrite Test: index.php?foo=$matches[1]&page=$matches[2]
Rewrite Result: index.php?foo=$matches[1]&p=$matches[2]&page=$matches[3]
Matched: bar/(.+?)/([0-9]+)(/[0-9]+)?/?$

And one rewrite rule is missing a test:

bar/(.+?)/page/?([0-9]{1,})/?$

johnbillion avatar Jun 12 '15 15:06 johnbillion