WordPress.org

Make WordPress Core

Ticket #42740: 42740.2.diff

File 42740.2.diff, 858 bytes (added by audrasjb, 20 months ago)

Add a great URL pattern which allows relative URLS.

  • src/wp-includes/widgets/class-wp-widget-media-image.php

    diff --git a/src/wp-includes/widgets/class-wp-widget-media-image.php b/src/wp-includes/widgets/class-wp-widget-media-image.php
    index e374b57..8a95135 100644
    a b class WP_Widget_Media_Image extends WP_Widget_Media { 
    329329                        <# if ( data.url ) { #>
    330330                        <p class="media-widget-image-link">
    331331                                <label for="{{ elementIdPrefix }}linkUrl"><?php esc_html_e( 'Link to:' ); ?></label>
    332                                 <input id="{{ elementIdPrefix }}linkUrl" type="url" class="widefat link" value="{{ data.link_url }}" placeholder="http://">
     332                                <input id="{{ elementIdPrefix }}linkUrl" type="text" class="widefat link" value="{{ data.link_url }}" placeholder="http://" pattern="((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#).*">
    333333                        </p>
    334334                        <# } #>
    335335                </script>