[wp-trac] [WordPress Trac] #36849: Filter to limit length of post slug (filter for _truncate_post_slug)

WordPress Trac noreply at wordpress.org
Mon May 16 15:07:19 UTC 2016


#36849: Filter to limit length of post slug (filter for _truncate_post_slug)
-------------------------------+------------------------------
 Reporter:  wp-entwickler.at   |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.5.2
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by wp-entwickler.at):

 Thanks for your fast reply!
 Sorry, I wasn't able to realize that _truncate_post_slug() is marked as
 private.

 The filter wp_unique_post_slug is fired at the very end of the function.
 All checks are done at this point. Final.

 If you alter the slug with this filter, no additional checks will be made.
 So it could happen that you're ending with a corrupt slug.

 It would be far better to alter the slug before things like the
 post_name_check, conflicts_with_date_archive check or the flat slug check
 were done.

 A possible solution could be to filter the hardcoded length (200 minus
 some stuff *gg*).

 Gruezi

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36849#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list