Skip to main content

benecaster_outlinks_health_exclusions_save_after

Action Premium outlinks

Fires once Link Health’s exclusions have been saved, from the Exclusions form on Settings → Link Health or the PATCH /benecaster-outlinks/v1/link-health/exclusions route. By then the links and images the new exclusions cover have been removed from Link Health’s list; $removed says how many.

It fires only for a request that sends at least one of the three lists and passes validation, the same requests that fire benecaster_outlinks_health_exclusions_save_before.

Link Health is install-wide and needs Outlinks switched on for at least one show, so the hook never fires while Outlinks is off for every show or the licence has lapsed.

Parameters

Name Type Default Description
$exclusions array — `[ 'domains' => …, 'post_types' => …, 'categories' => … ]` as saved
$previous array — The same three lists as they were before the save
$removed int — How many items the new exclusions removed from Link Health (the route's `removed`)

Examples

Log newly excluded domains

add_action( 'benecaster_outlinks_health_exclusions_save_after', function ( array $exclusions, array $previous, int $removed ): void {
    $added = array_diff( $exclusions['domains'], $previous['domains'] );
    if ( [] !== $added ) {
        error_log( sprintf( 'Link Health now skips %s (%d items removed)', implode( ', ', $added ), $removed ) );
    }
}, 10, 3 );

Notes

Need this built rather than just documented? See our services →