WordPress.org

Make WordPress Core

Changeset 46330


Ignore:
Timestamp:
09/26/2019 08:30:59 PM (3 weeks ago)
Author:
whyisjake
Message:

Menus: Replace http with https in placeholders.

Encourage the use of https with the placeholder text in menus.

Fixes #46312
Props aksl95, audrasjb, celloexpressions, SergeyBiryukov, jorbin.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/nav-menu.js

    r46240 r46330  
    951951            processMethod = processMethod || api.addMenuItemToBottom;
    952952
    953             if ( '' === url || 'http://' == url ) {
     953            if ( '' === url || 'https://' == url || 'http://' == url ) {
    954954                $('#customlinkdiv').addClass('form-invalid');
    955955                return false;
     
    963963                // Set custom link form back to defaults
    964964                $('#custom-menu-item-name').val('').blur();
    965                 $('#custom-menu-item-url').val('http://');
     965                $( '#custom-menu-item-url' ).val( '' ).attr( 'placeholder', 'https://' );
    966966            });
    967967        },
  • trunk/src/js/_enqueues/wp/customize/nav-menus.js

    r45979 r46330  
    585585
    586586            // Reset the custom link form.
    587             itemUrl.val( 'http://' );
     587            itemUrl.val( '' ).attr( 'placeholder', 'https://' );
    588588            itemName.val( '' );
    589589        },
  • trunk/src/wp-admin/includes/nav-menu.php

    r46309 r46330  
    293293        <p id="menu-item-url-wrap" class="wp-clearfix">
    294294            <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
    295             <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
     295            <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" placeholder="https://" />
    296296        </p>
    297297
     
    919919                    ! isset( $_item_object_data['menu-item-type'] ) ||
    920920                    // Or URL is the default.
    921                     in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) ||
     921                    in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) ||
    922922                    ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page)
    923923                    // Or it *is* a custom menu item that already exists.
  • trunk/src/wp-includes/class-wp-customize-nav-menus.php

    r45932 r46330  
    11931193                <p id="menu-item-url-wrap" class="wp-clearfix">
    11941194                    <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
    1195                     <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://">
     1195                    <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" placeholder="https://">
    11961196                </p>
    11971197                <p id="menu-item-name-wrap" class="wp-clearfix">
Note: See TracChangeset for help on using the changeset viewer.