Make WordPress Core

Opened 14 years ago

Last modified 6 years ago

#16843 new defect (bug)

wp_unique_post_slug() doesn't check pagination base when CPT has archive

Reported by: scribu's profile scribu Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.1
Component: Posts, Post Types Keywords: has-patch needs-unit-tests
Focuses: Cc:

Description

Title says it all.

Attachments (5)

16843.diff (3.1 KB) - added by scribu 14 years ago.
test-16843.php (262 bytes) - added by scribu 14 years ago.
16843.2.diff (3.1 KB) - added by scribu 14 years ago.
formatting
16843.3.diff (3.0 KB) - added by wonderboymusic 12 years ago.
16843.4.diff (3.2 KB) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (20)

@scribu
14 years ago

@scribu
14 years ago

#1 @scribu
14 years ago

16843.diff has the added bonus that it avoids an unnecessary query, if any of the preceding conditions match.

#2 @hakre
14 years ago

For better readability of the code, please add logical operators (mostly || in your patch) to the front of the line so it's easier to read how lines are in relation to each other.

@scribu
14 years ago

formatting

#3 @scribu
14 years ago

That does look better.

#4 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.1

What's the actual code change here? Just the final block of code, checking the pagination base?

#5 @scribu
13 years ago

  • Milestone changed from 3.1 to 3.2

You did mean 3.2, right?

The added line is indeed in the final block:

|| ( $post_type_obj->has_archive && $wp_rewrite->pagination_base == $slug )

#6 @scribu
13 years ago

  • Version set to 3.1

You probably meant to set the version, but I'll leave the milestone also.

#7 @scribu
13 years ago

  • Severity changed from normal to minor

#8 @ryan
13 years ago

  • Keywords 3.3-early added

Punting per bug scrub.

#9 @ryan
13 years ago

  • Milestone changed from 3.2 to Future Release

#10 @wonderboymusic
12 years ago

  • Milestone changed from Future Release to 3.6

Patch refreshed so it applies cleanly against trunk

#11 @nacin
11 years ago

  • Keywords needs-unit-tests added

Some proper unit tests would be great here.

I'm seeing preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) for hierarchical post types, is that not necessary here?

#12 @nacin
11 years ago

  • Milestone changed from 3.6 to Future Release

Punting as this is minor.

#13 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.7

16843.4.diff​ is fuzz-less​

#14 @nacin
11 years ago

  • Milestone changed from 3.7 to Future Release

Still needs tests, I think.

#15 @chriscct7
9 years ago

  • Keywords 3.3-early removed
Note: See TracTickets for help on using tickets.