Make WordPress Core

Ticket #35194: 35194.2.diff

File 35194.2.diff, 1.7 KB (added by peterwilsoncc, 8 years ago)
  • src/wp-includes/embed.php

    diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php
    index 2736204..17b9ac4 100644
    a b function wp_oembed_register_route() { 
    345345function wp_oembed_add_discovery_links() {
    346346        $output = '';
    347347
    348         if ( is_singular() ) {
     348        if ( is_singular() && ! is_front_page() ) {
    349349                $output .= '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
    350350
    351351                if ( class_exists( 'SimpleXMLElement' ) ) {
  • tests/phpunit/tests/oembed/discovery.php

    diff --git a/tests/phpunit/tests/oembed/discovery.php b/tests/phpunit/tests/oembed/discovery.php
    index 63eb5bb..6331602 100644
    a b class Tests_oEmbed_Discovery extends WP_UnitTestCase { 
    88                $this->assertSame( '', get_echo( 'wp_oembed_add_discovery_links' ) );
    99        }
    1010
     11        function test_add_oembed_discovery_links_front_page() {
     12                $this->go_to( home_url('/') );
     13                $this->assertSame( '', get_echo( 'wp_oembed_add_discovery_links' ) );
     14        }
     15
     16        function test_add_oembed_discovery_links_static_front_page() {
     17                update_option( 'show_on_front', 'page' );
     18                update_option( 'page_for_posts', self::factory()->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
     19                update_option( 'page_on_front', self::factory()->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
     20
     21                $this->go_to( home_url('/') );
     22                $this->assertSame( '', get_echo( 'wp_oembed_add_discovery_links' ) );
     23
     24                update_option( 'show_on_front', 'posts' );
     25        }
     26
    1127        function test_add_oembed_discovery_links_to_post() {
    1228                $post_id = self::factory()->post->create();
    1329                $this->go_to( get_permalink( $post_id ) );