Reputation: 23
I need to put link to chat in Viber on this site. This link looks like this:
<a href='viber://chat?number=ххххххххх' target='_blank'>Link</a>
But it doesn't work! If I use code above on site, eventually it gives this link:
<a href='//chat?number=ххххххххх' target='_blank'>Link</a>
I can guess, wordpress (or maybe plugin JetPack, I don't know) deletes unfamiliar protocols (but leave protocols like https, http).
So my question - what is the problem and how can I fix it without javascript (js forbidden :( )?
Upvotes: 0
Views: 2740
Reputation: 556
In your theme functions.php (preferable child theme) add this to allow viber protocol.
add_filter( 'kses_allowed_protocols', function ( $protocols ) {
$protocols[] = 'viber';
return $protocols;
} );
Upvotes: 3
Reputation: 1
The problem is that you are using wp_kses_post to display link but 'viber:' is not in the list of allowed protocols. To fix it you just have to add 'viber:' to allowed protocols list or use a different way to display content.
Upvotes: 0