Opened 9 years ago
Closed 4 years ago
#33756 closed defect (bug) (fixed)
Improve docs for sanitize_title()
Reported by: | ericlewis | Owned by: | psdtohtmlguru |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | good-first-bug has-patch |
Focuses: | docs | Cc: |
Description
It's not immediately clear what sanitize_title()
does. Adding doc modifications.
Attachments (5)
Change History (27)
#3
@
9 years ago
Sanitizes a string for use as a slug in a URL.
is incomplete. Also sanitizes for use as HTML id or class attribute value. There may be other uses...
#4
@
9 years ago
- Owner changed from DrewAPicture to swissspidy
See comment:3 for other use cases we need to cover.
#5
@
9 years ago
- Milestone changed from 4.4 to Future Release
Still some work left here. Let's move it off the milestone until there's a consensus on the best way to document the intent vs the actual usage of these functions. I'd probably suggest going the route of describing the literal characters removed or accepted for any of these formatting functions – since they tend to get used in all sorts of contexts unrelated to the original intent.
#6
@
9 years ago
- Keywords needs-patch good-first-bug added; has-patch removed
- Owner swissspidy deleted
#8
in reply to:
↑ 7
@
9 years ago
Replying to psdtohtmlguru:
@DrewAPicture Can i have this ticket please?
A ticket does not belong to anybody, so feel free to submit a patch as you like :)
#10
@
9 years ago
- Owner changed from DrewAPicture to psdtohtmlguru
- Status changed from accepted to assigned
Assigning to mark the good-first-bug as "claimed".
#13
@
8 years ago
There's a tutorial for working with patches in the handbook: https://make.wordpress.org/core/handbook/tutorials/working-with-patches/
After creating a patch file you can upload it here to this ticket.
#14
@
8 years ago
Interested in taking this and finishing it. What are we trying to say at this point? Not sure on the language from reading comments.
`
#15
follow-up:
↓ 16
@
8 years ago
@wonderboymusic
Sanitizes a string for use as a slug in a URL. is incomplete. Also sanitizes for use as HTML id or class attribute value. There may be other uses...
Not sure if I'm missing something here, but basically sanitize_title() strip tags, removes accents and replace special characters, right? I'm not really sure what you mean with id or class attribute value.
#16
in reply to:
↑ 15
@
8 years ago
Maybe it's just that the sanitize_title
function is sometimes used to generate an id or class from a string to ensure that non authorized characters are not used... Maybe useful only when generating attributes from inputed text.
Replying to gma992:
@wonderboymusic
Sanitizes a string for use as a slug in a URL. is incomplete. Also sanitizes for use as HTML id or class attribute value. There may be other uses...Not sure if I'm missing something here, but basically sanitize_title() strip tags, removes accents and replace special characters, right? I'm not really sure what you mean with id or class attribute value.
This ticket was mentioned in Slack in #core by welcher. View the logs.
7 years ago
#18
@
7 years ago
- Keywords has-patch added; needs-patch removed
@tim1602 and I worked on another possible solution at contributor day at WordCamp DFW 2017.
Since some of the pushback in early patches seemed to be that we weren't handling all of the cases of sanitize_title(), for example how it's used in URLs in some cases, and attributes in others... It seemed like it might be best to stay ambiguous and then mention URLs and attributes as examples.
We also tried to expand on the long description by mentioning the sanitize_title filter and the default output.
After looking at the PHP Documentation Standards I made some small adjustments to your patch, adding/removing newlines and backticks where necessary.