Home Forums Backend Issues (wp-admin) Phone field with href="tel:" link Reply To: Phone field with href="tel:" link

  • webicient

    Hello, I’ve added your code like this:

    add_filter('acf/format_value/name=ტელეფონის_ნომერი', 'convert_phone_to_link', 20, 3);
    function convert_phone_to_link ($value, $post_id, $field) {
      if (!$value) {
        // no value
        return $value;
      // get the tel link field
      $tel_link = get_field('-phone-number');
      if (!$tel_link) {
        // no link
        return $value;
      $value = '<a href="tel:'.$tel_link.'">'.$value.'</a>';
      return $value;
    $(#phone-button a").attr("href", function ( index, currentvalue) {
        var url_format = currentvalue.replace(/(^\w+:|^)\/\//, "");
        $(this).attr("href", "tel:" + url_format);

    But it shows me a fatal error in the first line of your code.
    Here: $(#phone-button a”).attr(“href”, function ( index, currentvalue)