Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#52444 new enhancement

Add support for Telegram Messenger Protocol

Reported by: customer8765's profile customer8765 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3
Component: Formatting Keywords: 2nd-opinion close
Focuses: Cc:

Description

I found an issue with a link to Telegram messenger.

The simple link works correct
<a href="tg://resolve?domain=man_o2">

If I add “target”, it works correct on pages.
<a href="tg://resolve?domain=man_o2" target="_blank">

But if I use it in «Custom HTML» widget, I see a wrong result code:
<a href="//resolve?domain=man_o2" target="_blank">

I asked The7 theme support and they have said “it works the same with the standard WP theme”.

Screenshot from support:https://www.evernote.com/l/AnTcHk6kxa5Ltb_UT4cgDp7V-ofL4md-1fQ

Change History (8)

#1 @customer8765
2 years ago

There is the same problem with "Text" widget.

#2 @SergeyBiryukov
2 years ago

  • Component changed from Widgets to Formatting

#3 @brookedot
2 years ago

  • Keywords 2nd-opinion added
  • Summary changed from Link to Telegram messenger issue to Add support for Telegram Messenger Protocol

I looked into this for a few minutes, and it looks like the protocol is being stripped by wp_allowed_protocols in: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/functions.php#L6383

The good news is that this is filterable with the kses_allowed_protocols filter.
https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/

ie:

add_filter( 'kses_allowed_protocols', function ( $protocols ) {
    $protocols[] = 'tg';
    return $protocols;
} );

Adding needs second opinion on if we should support the tg protocol when not all apps are supported and the function is filterable.

This ticket was mentioned in Slack in #core by bandonrandon. View the logs.


2 years ago

#5 @Clorith
2 years ago

I tend to lean towards not adding the protocols. There are so many custom protocols out there, that adding one will lead the project down a rabbit hold of "why was X added but not Y".

As @brookedot mentions, there are filters in place for those who want to add custom protocols to their sites, and this feels like the right solution in this case.

#6 @brookedot
2 years ago

  • Keywords close added

#7 @brookedot
2 years ago

  • Type changed from defect (bug) to enhancement

#8 @brookedot
2 years ago

  • Version changed from 5.6.1 to 3.3
Note: See TracTickets for help on using tickets.