Menus: Trim whitespace from custom link URLs.

Props majemedia, SergeyBiryukov.
Fixes #47723.
Built from https://develop.svn.wordpress.org/trunk@45655


git-svn-id: http://core.svn.wordpress.org/trunk@45466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-07-17 18:45:58 +00:00
parent 24d08a9463
commit f7c4398ea9
2 changed files with 10 additions and 6 deletions

View File

@ -456,11 +456,15 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
$original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0;
if ( 'custom' != $args['menu-item-type'] ) {
/* if non-custom menu item, then:
* use original object's URL
* blank default title to sync with original object's
*/
if ( 'custom' === $args['menu-item-type'] ) {
// If custom menu item, trim the URL.
$args[ 'menu-item-url' ] = trim( $args[ 'menu-item-url' ] );
} else {
/*
* If non-custom menu item, then:
* - use the original object's URL.
* - blank default title to sync with the original object's title.
*/
$args['menu-item-url'] = '';

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45654';
$wp_version = '5.3-alpha-45655';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.