I develops elementor widget.my a href code doesnt work like i want.the plugin works like that: admin set a url as text in elementor widget tab.and the text display as link for all equipment div:

   <div class="col-xs-12">

                        <div class="bag">

                            <?php $settings = $this->get_settings_for_display();

                            $html = wp_oembed_get($settings['url']);

                            echo '<a href="';

                            echo $settings['url'];

                            echo '">';


                                <div class="dot dot1">

you can look at the working link:


bottom of the link page there are box.you should click a box.then click right picture which is equipment (dot1) div.

when you click the equipment div, it opens:


however i want only sgdghd.com

  • And what does that $settings[‘url’] contain? Feb 11, 2020 at 19:21
  • 1
    It sounds like you have only entered "sgdghd.com" as the URL, and that's not a valid link. Try entering "sgdghd.com" and see if that works without prepending.
    – WebElaine
    Feb 11, 2020 at 20:31
  • Smoke detector doesn't like this post
    – user161710
    Feb 12, 2020 at 0:08

1 Answer 1


sgdghd.com is not a complete URL on its own, and if used in a link like <a href="sgdghd.com">, it will be treated as a relative URL. To properly link to a different domain, you need to include http:// or https://.

To ensure that a value for href is a valid URL, you should use esc_url() when outputting it. That way if a user enters an incomplete URL in the settings, it will still be output correctly:

echo '<a href="';

echo esc_url( $settings['url'] );

echo '">';
  • thanks, it works.can you vote my question?
    – ahmet kaya
    Feb 12, 2020 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.