[wp-trac] [WordPress Trac] #14111: wp_unique_post_slug() doesn't have a filter

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 16 22:02:33 UTC 2011


#14111: wp_unique_post_slug() doesn't have a filter
-------------------------------------------------+-----------------------
 Reporter:  Viper007Bond                         |       Owner:  westi
     Type:  enhancement                          |      Status:  reopened
 Priority:  lowest                               |   Milestone:  3.3
Component:  Permalinks                           |     Version:
 Severity:  trivial                              |  Resolution:
 Keywords:  has-patch needs-testing westi-likes  |
-------------------------------------------------+-----------------------
Changes (by Vynce):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Summary: i would recommend instead inserting this at line 2835:
 {{{ $alt_post_name = substr( $slug, 0, 200 – ( strlen( $suffix ) + 1 ) ) .
 “-$suffix”; }}}

 Reasoning: the way [18546] was implemented the uniqueness does not appear
 to take
 into account the filter. for instance, assume I have a filter that
 converts that – to a _.

    1. first, i create post ‘counting’
    1. then i try to create ‘counting’ and that’s not unique, so I go into
 the loop and get ‘counting-2′, which is unique, so i exit the loop with
 counting-2, which i filter to ‘counting_2′.
    1. then i try to create ‘counting’ and that’s not unique, so i go into
 the loop and get ‘counting-2′, which is unique, so i exit the loop with
 counting-2, which i filter to ‘counting_2′ — which isn’t unique.
    1. chaos

 If, on the other hand, the filter were on line 2835, then I believe
 it would actually unique the value that was going to be used, instead
 of something else.

 .

 Vynce

 .

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14111#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list