Change the wording of the Link Health warning under Notifications
benecaster_outlinks_health_notice_message runs at the end of each finished Link Health check, only when the Link Health notice is about to be shown because something is broken. A check that finds nothing broken removes the notice and never calls it.
$message is the default in the site’s language, “Link Health found 3 broken links or images on your site.”; $count is how many items it counts; $broken_items is the list described in Run your own code when a Link Health check finishes. The return is trimmed and becomes the notice’s message.
Code
<?php
add_filter( 'benecaster_outlinks_health_notice_message', function ( string $message, int $count, array $broken_items ): string {
$tracked = count( array_filter( $broken_items, fn( array $item ): bool => 'redirect' === $item['kind'] ) );
return $tracked > 0 ? sprintf( '%d broken, %d of them tracked links. Fix the tracked ones first.', $count, $tracked ) : $message;
}, 10, 3 );
Hooks Used
Need this built rather than just documented? See our services →