mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Robots: Add max-image-preview:large directive by default.
This changeset introduces a `wp_robots_max_image_preview_large()` function which is hooked into the `wp_robots` filter to include the `max-image-preview:large` directive for all sites which are configured to be indexed by search engines. The directive allows search engines to display large image previews for the site in search results. Props adamsilverstein, Clorith, flixos90, helen, joostdevalk, tweetythierry, westonruter. Fixes #51511. git-svn-id: https://develop.svn.wordpress.org/trunk@50078 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -161,6 +161,21 @@ class Tests_Robots extends WP_UnitTestCase {
|
||||
$this->assertContains( "'noindex, noarchive'", $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 51511
|
||||
*/
|
||||
public function test_wp_robots_max_image_preview_large() {
|
||||
add_filter( 'wp_robots', 'wp_robots_max_image_preview_large' );
|
||||
|
||||
update_option( 'blog_public', '1' );
|
||||
$output = get_echo( 'wp_robots' );
|
||||
$this->assertContains( "'max-image-preview:large'", $output );
|
||||
|
||||
update_option( 'blog_public', '0' );
|
||||
$output = get_echo( 'wp_robots' );
|
||||
$this->assertEmpty( $output );
|
||||
}
|
||||
|
||||
public function add_noindex_directive( array $robots ) {
|
||||
$robots['noindex'] = true;
|
||||
return $robots;
|
||||
|
||||
Reference in New Issue
Block a user