[wp-trac] [WordPress Trac] #33956: New function: `get_the_slug()`

WordPress Trac noreply at wordpress.org
Tue Sep 22 07:39:07 UTC 2015


#33956: New function: `get_the_slug()`
-------------------------------------------------+-------------------------
 Reporter:  sebastian.pisula                     |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Posts, Post Types                    |  Review
 Severity:  normal                               |     Version:
 Keywords:  has-patch needs-refresh needs-unit-  |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------
Changes (by swissspidy):

 * keywords:   => has-patch needs-refresh needs-unit-tests


Comment:

 Thanks for the patch!

 Just some notes:

 * Brackets shouldn't be on the new line
 * It should be possible to pass a WP_Post object and not only an ID
 * Lacks some more documentation, especially for the filter
 * You got some IntelliJ/PhpStorm headers in your diff. Try to remove those
 * Core uses slugs at many points, why not use this new function there?

 See https://make.wordpress.org/core/handbook/best-practices/coding-
 standards/php/ and https://make.wordpress.org/core/handbook/best-practices
 /inline-documentation-standards/php/

 It's worth noting that many people implemented their own `the_slug`
 functions over the years so this might break some sites.

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


More information about the wp-trac mailing list