diff --git src/js/_enqueues/lib/nav-menu.js src/js/_enqueues/lib/nav-menu.js
index cd62acc36f..3f1f9a7480 100644
|
|
|
944 | 944 | }, |
945 | 945 | |
946 | 946 | addCustomLink : function( processMethod ) { |
947 | | var url = $('#custom-menu-item-url').val(), |
| 947 | var url = $('#custom-menu-item-url').val().trim(), |
948 | 948 | label = $('#custom-menu-item-name').val(); |
949 | 949 | |
950 | 950 | processMethod = processMethod || api.addMenuItemToBottom; |
diff --git src/js/_enqueues/wp/customize/nav-menus.js src/js/_enqueues/wp/customize/nav-menus.js
index b6560366c1..200635d320 100644
|
|
|
544 | 544 | var menuItem, |
545 | 545 | itemName = $( '#custom-menu-item-name' ), |
546 | 546 | itemUrl = $( '#custom-menu-item-url' ), |
| 547 | itemUrlVal, |
547 | 548 | urlRegex; |
548 | 549 | |
549 | 550 | if ( ! this.currentMenuControl ) { |
… |
… |
|
564 | 565 | */ |
565 | 566 | urlRegex = /^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/; |
566 | 567 | |
| 568 | itemUrlVal = itemUrl.val().trim(); |
| 569 | |
567 | 570 | if ( '' === itemName.val() ) { |
568 | 571 | itemName.addClass( 'invalid' ); |
569 | 572 | return; |
570 | | } else if ( ! urlRegex.test( itemUrl.val() ) ) { |
| 573 | } else if ( ! urlRegex.test( itemUrlVal ) ) { |
571 | 574 | itemUrl.addClass( 'invalid' ); |
572 | 575 | return; |
573 | 576 | } |
574 | 577 | |
575 | 578 | menuItem = { |
576 | 579 | 'title': itemName.val(), |
577 | | 'url': itemUrl.val(), |
| 580 | 'url': itemUrlVal, |
578 | 581 | 'type': 'custom', |
579 | 582 | 'type_label': api.Menus.data.l10n.custom_label, |
580 | 583 | 'object': 'custom' |