Make WordPress Core

Opened 9 years ago

Last modified 3 years ago

#37068 new enhancement

wp_unique_post_slug() should accept `$post` parameter rather than post properties

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

Breaking this ticket off from #20419.

The function signature for wp_unique_post_slug()' is currently:

function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent )

This is a departure from wp_unique_term_slug(), which accepts two parameters: $slug and $term (where $term is a term object). For greater consistency, we should prefer a post object in wp_unique_post_slug().

There are also some cases where the current function signature requires weird hacks, such as when generating sample permalinks. See #20419. Another argument for standardizing the signature.

Latest patch is at https://core.trac.wordpress.org/attachment/ticket/20419/20419.5.diff

Change History (3)

#1 @boonebgorges
8 years ago

  • Keywords 4.7-early added
  • Milestone changed from 4.6 to Future Release
  • Type changed from defect (bug) to enhancement

This ticket was mentioned in Slack in #core by helen. View the logs.


8 years ago

#3 @johnbillion
3 years ago

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