Opened 6 years ago
Closed 6 years ago
#3688 closed defect (bug) (fixed)
Permalink for methods are wrong when using sub-namespaces
Reported by: | keesiemeijer | Owned by: | obenland |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Developer Hub | Keywords: | has-patch |
Cc: |
Description
The permalink for methods if left unfiltered by the 'post_type_link' are in this format:
/classes/class_name-method_name
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:
/reference/classes/class_name/method_name
If you use a namespace like this namespace MyProject\Sub\Level;
the unfiltered permalink is:
/classes/myproject-sub-level-class_name-method_name
Now with the filter all methods with this namescpace have a permalink like this:
/reference/classes/myproject/sub
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.
reference/classes/myproject-sub-level-class_name/method_name
I know WordPress doesn't use namespaces (now) but we should provide basic support.
Attachments (1)
Change History (2)
Note: See
TracTickets for help on using
tickets.
Fix method permalinks