[wp-meta] [Making WordPress.org] #3688: Permalink for methods are wrong when using sub-namespaces

Making WordPress.org noreply at wordpress.org
Wed Jun 27 11:28:41 UTC 2018

#3688: Permalink for methods are wrong when using sub-namespaces
 Reporter:  keesiemeijer   |      Owner:  (none)
     Type:  defect         |     Status:  new
 Priority:  normal         |  Milestone:
Component:  Developer Hub  |   Keywords:  has-patch
 The permalink for methods if left unfiltered by the 'post_type_link' are
 in this format:


 With the `post_type_link` filter the slug is changed by splitting it by
 `-`. The part found after the first `-` is used as the method name.
 Formatted like this:


 If you use a namespace like this `namespace MyProject\Sub\Level;` the
 unfiltered permalink is:


 Now with the filter all methods with this namescpace have a permalink like


 The following patch fixes this by using the (namespaced) parent post slug
 for the class name. The method name is found by subtracting the
 (namespaced) parent slug from the method slug.


 I know WordPress doesn't use namespaces (now) but we should provide basic

Ticket URL: <https://meta.trac.wordpress.org/ticket/3688>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org

More information about the wp-meta mailing list