Skip to content

Commit 57f8237

Browse files
committed
Exclude amzn.to links from broken link detection
Amazon short links (amzn.to) frequently time out or return misleading status codes, producing false positives in the link health checker. Skip these links entirely in check_single_link() by returning 'ok' immediately when the host is amzn.to. https://claude.ai/code/session_0114nzYukNFeahGbWczuMMpV
1 parent c8161ad commit 57f8237

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

includes/class-rtg-link-checker.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ public static function save_results( $total, $broken ) {
192192
* @return array {status, reason, http_code}
193193
*/
194194
public static function check_single_link( $url ) {
195+
// Amazon short links (amzn.to) are excluded from broken link
196+
// detection — they frequently time out or return misleading
197+
// status codes, producing false positives.
198+
$parsed_host = wp_parse_url( $url, PHP_URL_HOST );
199+
if ( $parsed_host && 'amzn.to' === strtolower( $parsed_host ) ) {
200+
return array(
201+
'status' => 'ok',
202+
'reason' => '',
203+
'http_code' => 0,
204+
);
205+
}
206+
195207
// Use GET instead of HEAD because many affiliate networks
196208
// (CJ, ShareASale, etc.) only redirect GET requests.
197209
$response = wp_remote_get( $url, array(

0 commit comments

Comments
 (0)