Function 'make_clickable()' doesn't make hyperlinks from explicit URLs using the `mailto:`, `tel:` and other schemes that do not start with `//`
|Reported by:||mdgl||Owned by:|
|Component:||Formatting||Keywords:||needs-unit-tests dev-feedback needs-testing|
Function make_clickable() tries to recognise URLs and convert these into clickable hyperlinks. The function is by default configured as a filter for comment text.
Unfortunately, the function assumes that all explicitly declared URLs begin with the string // after the scheme and colon parts which is not the case for the mailto:, tel: and many other schemes. Such URLs could usefully be made clickable, especially for use on smartphones and tablets.
This also leads to inconsistencies between explicitly and implicitly declared URLs. For example, the string firstname.lastname@example.org is converted into a clickable hyperlink whilst the string mailto:email@example.com is not.
By contrast, the TinyMCE post editor correctly and automatically makes both implicit and explicit mailto: links clickable but does nothing with tel:.
As #16892 has illustrated, parsing URLs can be hard. The use of wp_allowed_protocols() may help in detecting which strings we wish to make clickable.
Found whilst testing #22946.
Change History (5)
- Keywords needs-patch needs-unit-tests added
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to enhancement