Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/wp-admin/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@

#dashboard_right_now .search-engines-info:before {
content: "\f348";
color: #d63638;
}

/* Dashboard WordPress events */
Expand Down
47 changes: 47 additions & 0 deletions src/wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -2687,6 +2687,49 @@ public function get_test_autoloaded_options() {
return $result;
}

/**
* Tests whether search engine indexing is enabled.
*
* Surfaces as “good” if `blog_public === 1`, or “recommended” if `blog_public === 0`.
*
* @since 6.9
*
* @return array The test results.
*/
public function get_test_search_engine_visibility() {
$result = array(
'label' => __( 'Search engine indexing is enabled.', 'default' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Privacy', 'default' ),
'color' => 'blue',
),
'description' => sprintf(
'<p>%s</p>',
__( 'Search engines can crawl and index your site. No action needed.', 'default' )
),
'actions' => sprintf(
'<p><a href="%1$s">%2$s</a></p>',
esc_url( admin_url( 'options-reading.php#blog_public' ) ),
__( 'Review your visibility settings', 'default' )
),
'test' => 'search_engine_visibility',
);

// If indexing is discouraged, flip to “recommended”:
if ( ! get_option( 'blog_public' ) ) {
$result['status'] = 'recommended';
$result['label'] = __( 'Search engines are discouraged from indexing this site.', 'default' );
$result['badge']['color'] = 'blue';
$result['description'] = sprintf(
'<p>%s</p>',
__( 'Your site is hidden from search engines. Consider enabling indexing if this is a public site.', 'default' )
);
}

return $result;
}

/**
* Returns a set of tests that belong to the site status page.
*
Expand Down Expand Up @@ -2775,6 +2818,10 @@ public static function get_tests() {
'label' => __( 'Autoloaded options' ),
'test' => 'autoloaded_options',
),
'search_engine_visibility' => array(
'label' => __( 'Search Engine Visibility' ),
'test' => 'search_engine_visibility',
),
),
'async' => array(
'dotorg_communication' => array(
Expand Down
Loading