Skip to main content

Run your own code when a site-wide Outlinks link is created

Premium Intermediate Outlinks

These fire around each new site-wide link, a tracked /go/ link that belongs to no show:

They fire the same way from benecaster_outlinks_site_link(), POST /benecaster-outlinks/v1/site-links and the Add link form on Settings → Site-wide Links. Nothing fires when an existing link is found and returned, or for a request refused before anything is written (an unusable URL or name).

Code

<?php
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 );

View on GitHub →

Hooks Used

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