• Resolved valikoblr

    (@valikoblr)


    Customizing ▸ General > Social Links

    Good time!
    if i add such a record<https://msng.link/o/?375296701401=vi> in custom 1 field, it works.

    But if I add a record to custom1 <viber://chat?number=+375296701401>, it doesn’t work, or rather, it doesn’t save. After clicking the save button, this field becomes empty again.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there!

    Glad you reached out to us about this.

    There is a function we use to sanitize URLs and make sure that they are safe. The link you’re using is sanitized because of the “:” and “/” characters.

    You can allow the viber link by adding a PHP code snippet like this:

    function allow_viber_in_esc_attr($safe_text, $text) {
    if (strpos($text, 'viber://') === 0) {
    return $text; // Return unescaped Viber link
    }
    return $safe_text;
    }
    add_filter('attribute_escape', 'allow_viber_in_esc_attr', 10, 2);


    function allow_viber_protocol_in_urls($good_protocol_url, $original_url, $_context) {
    if (strpos($original_url, 'viber://') === 0) {
    return $original_url; // Keep the original Viber URL
    }
    return $good_protocol_url;
    }
    add_filter('clean_url', 'allow_viber_protocol_in_urls', 10, 3);


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

    Here’s a guide on how you will add this safely: How to add a custom filter or function with Code Snippets

    Lastly, I added a feature request for it.

    I hope this helps and let me know if I can assist you further.

    Thread Starter valikoblr

    (@valikoblr)

    Thank you, I will do so! Please also add Viber to the list of social icons. I think many people still use it. Thank you for your concern! All the best!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Social links’ is closed to new replies.