WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37565 closed feature request (maybelater)

Different protocols than http and https are ripped off at individual links

Reported by: keksmampfer Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords:
Focuses: Cc:
PR Number:

Description

Hi,

i want to add links to the menu using the protokolls ts3server:// and steam:// .
But it fails!

The result is: <a>Link Text</a>

Expected result: <a href="ts3server://..">Link Text</a>

Change History (1)

#1 @dd32
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed
  • Type changed from defect (bug) to feature request

WordPress has a whitelist of valid URL protocols which can be used, both steam and ts3server are not currently whitelisted, and personally I don't think should be whitelisted for the majority of users.

You can easily add this ability for your site by adding the following code to a plugin or custom theme functions.php:

// Whitelist the steam:// and ts3server:// protocols for links
add_filter( 'kses_allowed_protocols', function( $protocols ) {
    $protocols[] = 'steam';
    $protocols[] = 'ts3server';
    return $protocols;
} );

I'm sure there's probably a generic plugin on the Plugin Directory to do that, but I couldn't see one with a quick look.

Note: See TracTickets for help on using tickets.