[wp-trac] [WordPress Trac] #20419: get_sample_permalink() passes the wrong post_status to wp_unique_post_slug()

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 11 23:15:39 UTC 2012


#20419: get_sample_permalink() passes the wrong post_status to
wp_unique_post_slug()
--------------------------+-----------------------------
 Reporter:  mintindeed    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  3.3
 Severity:  minor         |   Keywords:  has-patch
--------------------------+-----------------------------
 get_sample_permalink() fakes a 'publish' post_status so that it can create
 a pseudo-permalink for drafts and scheduled posts.  Also
 wp_unique_post_slug() bails when the post_status is 'draft', 'pending', or
 'auto-draft', so faking a 'publish' post_status helps there too.

 However, that means the incorrect post_status is passed to the
 'wp_unique_post_slug' filter at times, creating unexpected behaviour --
 namely sometimes the $post_status parameter of the wp_unique_post_slug
 filter will report a non-published post is published.

 The best approach here seems to be to let the wp_unique_post_slug()
 function know when a fake $post_status is being passed to it, what that
 status is so it can be passed to the wp_unique_post_slug filter.  That way
 anybody using the filter will always get the actual post status all the
 time without having to do anything special.

 Related: #14111

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20419>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list