benecaster_outlinks_redirect_destination_sync_after
Fires once a tracked link’s destination has followed an edit to its Reference Library item’s URL, and only when the link was actually updated. A write that changed nothing fires benecaster_outlinks_redirect_destination_sync_before with no after.
$redirect is the tracked link as it was before the write, so $redirect['destination_url'] is the old URL and $destination the new one.
It fires only where Outlinks is switched on for the item’s show and the licence is current.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$redirect |
array |
— | The tracked link before the write |
$destination |
string |
— | The new destination URL (`http` or `https`, cleaned) |
Examples
Log each destination change
add_action( 'benecaster_outlinks_redirect_destination_sync_after', function ( array $redirect, string $destination ): void {
error_log( sprintf( '/go/%s now sends visitors to %s (was %s)', $redirect['slug'], $destination, $redirect['destination_url'] ) );
}, 10, 2 );
Notes
Need this built rather than just documented? See our services →