benecaster_outlinks_site_link_create_after
Fires once Outlinks has created a new site-wide link: a tracked /go/ link that belongs to no show, such as a guest’s book tracked from Guest Manager.
It fires the same way whichever path created the link: the benecaster_outlinks_site_link() function, the POST /benecaster-outlinks/v1/site-links route, or the Add link form on Settings → Site-wide Links. Nothing fires when a site-wide link to the same address already existed and was returned instead.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$redirect_id |
int |
— | ID of the new site-wide link |
$url |
string |
— | The destination address, as stored |
$slug |
string |
— | The link's name, the part after `/go/` |
Examples
Log each new site-wide link
add_action( 'benecaster_outlinks_site_link_create_after', function ( int $redirect_id, string $url, string $slug ): void {
error_log( sprintf( 'Outlinks site-wide link %d: /go/%s -> %s', $redirect_id, $slug, $url ) );
}, 10, 3 );
Notes
Its pair is benecaster_outlinks_site_link_create_before. Walkthrough: Run your own code when a site-wide Outlinks link is created.
Need this built rather than just documented? See our services →