Make WordPress Core

Opened 16 years ago

Last modified 7 years ago

#16843 new defect (bug)

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

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

Description

Title says it all.

Attachments (5)

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

Download all attachments as: .zip

Change History (20)

@scribu
16 years ago

@scribu
16 years ago

#1 @scribu
16 years ago

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

#2 @hakre
16 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
16 years ago

formatting

#3 @scribu
16 years ago

That does look better.

#4 @nacin
15 years ago

  • Milestone Awaiting Review3.1

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

#5 @scribu
15 years ago

  • Milestone 3.13.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
15 years ago

  • Version3.1

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

#7 @scribu
15 years ago

  • Severity normalminor

#8 @ryan
15 years ago

  • Keywords 3.3-early added

Punting per bug scrub.

#9 @ryan
15 years ago

  • Milestone 3.2Future Release

#10 @wonderboymusic
14 years ago

  • Milestone Future Release3.6

Patch refreshed so it applies cleanly against trunk

#11 @nacin
13 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
13 years ago

  • Milestone 3.6Future Release

Punting as this is minor.

#13 @wonderboymusic
13 years ago

  • Milestone Future Release3.7

16843.4.diff​ is fuzz-less​

#14 @nacin
13 years ago

  • Milestone 3.7Future Release

Still needs tests, I think.

#15 @chriscct7
11 years ago

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