Make WordPress Core

Opened 8 months ago

Last modified 8 months ago

#52444 new enhancement

Add support for Telegram Messenger Protocol

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


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
8 months ago

There is the same problem with "Text" widget.

#2 @SergeyBiryukov
8 months ago

  • Component changed from Widgets to Formatting

#3 @brookedot
8 months 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.


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.

8 months ago

#5 @Clorith
8 months 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
8 months ago

  • Keywords close added

#7 @brookedot
8 months ago

  • Type changed from defect (bug) to enhancement

#8 @brookedot
8 months ago

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