Make WordPress Core

Changeset 45028


Ignore:
Timestamp:
03/27/2019 12:15:15 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Themes: Remove itemprop="url" from get_custom_logo() output.

Making incorrect assumptions about microdata used in a theme results in invalid markup.

The attribute can still be added using the get_custom_logo or wp_get_attachment_image_attributes filter, but it should not be added by default.

Props henry.wright, tfrommen, afercia, markcallen, zodiac1978.
Fixes #37305.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r44956 r45028  
    949949    if ( $custom_logo_id ) {
    950950        $custom_logo_attr = array(
    951             'class'    => 'custom-logo',
    952             'itemprop' => 'logo',
     951            'class' => 'custom-logo',
    953952        );
    954953
     
    967966         */
    968967        $html = sprintf(
    969             '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
     968            '<a href="%1$s" class="custom-logo-link" rel="home">%2$s</a>',
    970969            esc_url( home_url( '/' ) ),
    971970            wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr )
  • trunk/tests/phpunit/tests/general/template.php

    r44785 r45028  
    309309
    310310        $custom_logo_attr = array(
    311             'class'    => 'custom-logo',
    312             'itemprop' => 'logo',
     311            'class' => 'custom-logo',
    313312        );
    314313
     
    323322        restore_current_blog();
    324323
    325         $expected_custom_logo = '<a href="' . $home_url . '" class="custom-logo-link" rel="home" itemprop="url">' . $image . '</a>';
     324        $expected_custom_logo = '<a href="' . $home_url . '" class="custom-logo-link" rel="home">' . $image . '</a>';
    326325        $this->assertEquals( $expected_custom_logo, get_custom_logo( $blog_id ) );
    327326    }
     
    339338
    340339        $custom_logo_attr = array(
    341             'class'    => 'custom-logo',
    342             'itemprop' => 'logo',
     340            'class' => 'custom-logo',
    343341        );
    344342
     
    351349        $image = wp_get_attachment_image( $this->custom_logo_id, 'full', false, $custom_logo_attr );
    352350
    353         $this->expectOutputString( '<a href="http://' . WP_TESTS_DOMAIN . '/" class="custom-logo-link" rel="home" itemprop="url">' . $image . '</a>' );
     351        $this->expectOutputString( '<a href="http://' . WP_TESTS_DOMAIN . '/" class="custom-logo-link" rel="home">' . $image . '</a>' );
    354352        the_custom_logo();
    355353    }
     
    371369            false,
    372370            array(
    373                 'class'    => 'custom-logo',
    374                 'itemprop' => 'logo',
     371                'class' => 'custom-logo',
    375372            )
    376373        );
    377374
    378         $this->expectOutputString( '<a href="http://' . WP_TESTS_DOMAIN . '/" class="custom-logo-link" rel="home" itemprop="url">' . $image . '</a>' );
     375        $this->expectOutputString( '<a href="http://' . WP_TESTS_DOMAIN . '/" class="custom-logo-link" rel="home">' . $image . '</a>' );
    379376        the_custom_logo();
    380377    }
Note: See TracChangeset for help on using the changeset viewer.