WordPress.org

Make WordPress Core

Ticket #30581: 30581.1.diff

File 30581.1.diff, 1.1 KB (added by peterwilsoncc, 3 years ago)
  • src/wp-includes/link-template.php

    src/wp-includes/link-template.php:3220: trailing whitespace.
    + * 
    
    
    
    diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
    index 58b722c..1200d89 100644
    a b function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) { 
    32163216/**
    32173217 * Output rel=canonical for singular queries.
    32183218 *
     3219 * Ensure the canonical URL's scheme matches the scheme of home_url
     3220 *
    32193221 * @since 2.9.0
    32203222*/
    32213223function rel_canonical() {
    function rel_canonical() { 
    32313233        if ( $page = get_query_var('cpage') )
    32323234                $link = get_comments_pagenum_link( $page );
    32333235
     3236        $home = get_option( 'home' );
     3237        $canonical_scheme = parse_url( $home, PHP_URL_SCHEME );
     3238
     3239        if ( ! in_array( $canonical_scheme, array( 'http', 'https', 'relative' ) ) ) {
     3240                if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] ) {
     3241                        $canonical_scheme = 'https';
     3242                }
     3243        }
     3244
     3245        $link = set_url_scheme( $link, $canonical_scheme );
     3246
    32343247        echo "<link rel='canonical' href='$link' />\n";
    32353248}
    32363249