Issue with [rank_math_contact_info] shortcode generating incorrect tel: link

#1031641
  • Resolved alain haya
    Rank Math free

    I’m using the [rank_math_contact_info] shortcode to display my business details on my website. However, the phone number link it generates is causing an issue.

    When I click on the phone number link, it opens a blank page with the message: about:blank#blocked.

    I’ve inspected the HTML and noticed that the shortcode outputs a tel:// link with target=”_blank”, which is not the correct format for telephone links. This seems to be triggering the browser’s security mechanism, especially on both mobile and desktop, even in incognito mode.

    Expected behavior:

    The link should be in the format: (+34) 928 52 85 28

    It should not contain target=”_blank”

    Could you please look into this or provide a way to modify the output of the shortcode so the phone number is clickable without errors?

    Here is the URL where the issue can be seen: https://alainhaya.com/

    Thank you!

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you are facing with the [rank_math_contact_info] shortcode generating an incorrect tel: link. Thank you for bringing this to our attention.

    To modify the output of the shortcode and ensure that the phone number link is formatted correctly without the target="_blank", you can use a filter in your theme’s functions.php file. Here’s how you can do it:

    add_filter( 'rank_math/shortcode/contact/phone', function( $phone ) {
        return '' . esc_html( $phone ) . '';
    });

    This code snippet will ensure that the phone number is wrapped in an anchor tag with the correct tel: format and without the target="_blank".

    After adding this code, please check your website again to see if the issue is resolved. If you continue to experience problems, please reply to this ticket, and a human agent from our support team will assist you further.

    Thank you for your understanding, and we hope this helps resolve your issue!

    Sources:
    How to Set up ContactPage Schema » Rank Math
    How to Make Your Theme Rank Math Compatible » Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Issue with [rank_math_contact_info] shortcode generating incorrect tel: link’ is closed to new replies.