diff --git a/src/wp-includes/embed-functions.php b/src/wp-includes/embed-functions.php index 3fe4e1ad22..0b67ed5869 100644 --- a/src/wp-includes/embed-functions.php +++ b/src/wp-includes/embed-functions.php @@ -746,26 +746,27 @@ function wp_filter_oembed_result( $result, $data, $url ) { } /** - * Filters the string in the "more" link displayed after a trimmed excerpt. + * Filters the string in the 'more' link displayed after a trimmed excerpt. + * + * Replaces '[...]' (appended to automatically generated excerpts) with an + * ellipsis and a "Continue reading" link in the embed template. * * @since 4.4.0 * - * @param string $more_string The string shown within the more link. - * @return string The modified excerpt. + * @param string $more_string Default 'more' string. + * @return string 'Continue reading' link prepended with an ellipsis. */ function wp_embed_excerpt_more( $more_string ) { if ( ! is_embed() ) { return $more_string; } - return sprintf( - _x( '… %s', 'read more link' ), - sprintf( - '%s', - get_the_permalink(), - __( 'Read more' ) - ) + $link = sprintf( '%2$s', + esc_url( get_permalink() ), + /* translators: %s: Name of current post */ + sprintf( __( 'Continue reading %s' ), '' . get_the_title() . '' ) ); + return ' … ' . $link; } /** diff --git a/tests/phpunit/tests/oembed/template.php b/tests/phpunit/tests/oembed/template.php index b0bb1a330d..04a07ba984 100644 --- a/tests/phpunit/tests/oembed/template.php +++ b/tests/phpunit/tests/oembed/template.php @@ -194,7 +194,8 @@ class Tests_Embed_Template extends WP_UnitTestCase { function test_wp_embed_excerpt_more() { $post_id = self::factory()->post->create( array( - 'post_content' => 'Foo Bar', + 'post_title' => 'Foo Bar', + 'post_content' => 'Bar Baz', ) ); $this->assertEquals( '', wp_embed_excerpt_more( '' ) ); @@ -204,7 +205,7 @@ class Tests_Embed_Template extends WP_UnitTestCase { $actual = wp_embed_excerpt_more( '' ); $expected = sprintf( - '… Read more', + ' … Continue reading Foo Bar', get_the_permalink() );