[wp-trac] [WordPress Trac] #21112: Add pre_wp_unique_post_slug to override post slug handling

WordPress Trac noreply at wordpress.org
Mon Dec 14 11:34:44 UTC 2015


#21112: Add pre_wp_unique_post_slug to override post slug handling
----------------------------------+------------------------------
 Reporter:  coffee2code           |       Owner:
     Type:  enhancement           |      Status:  new
 Priority:  normal                |   Milestone:  Awaiting Review
Component:  Permalinks            |     Version:  3.4
 Severity:  normal                |  Resolution:
 Keywords:  has-patch needs-docs  |     Focuses:
----------------------------------+------------------------------

Comment (by javorszky):

 Just to add a bit more emphasis on this: a library we're using creates
 posts to keep track of scheduled events (wp's cron is not good enough). By
 default the post_name is not populated, but even when it is, because
 WordPress would do it on ajax, there's no authenticated user, and the post
 is pending. `wp_insert_post` strips `post_name` even if one was passed
 through [here](https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/post.php#L3014).

 Because there's no way to bypass this, on a large site when there are
 60,000+ entries with the same empty post_name, the server just comes to a
 grinding halt. It's also not great with hosts like WPEngine, that have a
 hard limit for script execution. It's 60 seconds in WPEngine's case.

 Currently the only way for us to do this is to essentially copy the entire
 `wp_insert_post` function, and remove all the things that would hit
 `wp_unique_post_slug` and call our version of it from within the library.
 It's not very WordPress way to be honest.

 Being able to short circuit the function would be AMAZING.

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


More information about the wp-trac mailing list