Opened 23 months ago
Last modified 3 weeks ago
#33756 assigned defect (bug)
Improve docs for sanitize_title()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | needs-patch good-first-bug |
| Focuses: | docs | Cc: |
Description
It's not immediately clear what sanitize_title() does. Adding doc modifications.
Attachments (4)
Change History (21)
@ericlewis
23 months ago
@swissspidy
23 months ago
#1
@swissspidy
23 months ago
#2
@DrewAPicture
23 months ago
- Owner set to DrewAPicture
- Status changed from new to reviewing
#3
@wonderboymusic
23 months 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
@DrewAPicture
23 months ago
- Owner changed from DrewAPicture to swissspidy
See comment:3 for other use cases we need to cover.
#5
@DrewAPicture
22 months 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
@swissspidy
20 months ago
- Keywords needs-patch good-first-bug added; has-patch removed
- Owner swissspidy deleted
#7
follow-up:
↓ 8
@psdtohtmlguru
17 months ago
@DrewAPicture Can i have this ticket please?
#8
in reply to:
↑ 7
@swissspidy
17 months 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 :)
#9
@DrewAPicture
17 months ago
- Owner set to DrewAPicture
- Status changed from reviewing to accepted
#10
@DrewAPicture
17 months ago
- Owner changed from DrewAPicture to psdtohtmlguru
- Status changed from accepted to assigned
Assigning to mark the good-first-bug as "claimed".
#11
@SergeyBiryukov
10 months ago
@psdtohtmlguru, still interested in making a patch?
#12
@psdtohtmlguru
10 months ago
@SergeyBiryukov Yes, i will submit soon.
#13
@swissspidy
10 months 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
@sjmur
5 months 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
@gma992
5 months 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
@shulard
3 months 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.
After looking at the PHP Documentation Standards I made some small adjustments to your patch, adding/removing newlines and backticks where necessary.