Skip to content

Commit 21ccf1f

Browse files
authored
Merge pull request #184 from RivianTrackr/claude/exclude-amzn-links-cbVc1
Exclude amzn.to links from broken link detection
2 parents c8161ad + 57f8237 commit 21ccf1f

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)