Skip to main content

benecaster_signed_link_base_url

Filter Free

Filters the landing URL an emailed signed link points at, before the token query argument is appended. Defaults to the show’s account page, falling back to the site home page when no account page is configured — never an empty string, because a link with no host is a broken email rather than a refused one.

This only decides what the recipient SEES. Benecaster consumes the token on init wherever it lands, so redirecting elsewhere does not skip validation or sign-in.

Return an absolute URL on this site. wp_safe_redirect() refuses an off-site host and drops the recipient on the home page instead — which looks like a broken link to them and gives you nothing in the logs.

Parameters

Name Type Default Description
$url string — The landing URL. Account page, or the home page as a fallback.
$purpose string — One of the `SignedLink::PURPOSE_*` constants.
$show_id int — Show context, `0` when the link is not show-scoped.

Returns: string

Examples

Land followers on a custom members page

add_filter( 'benecaster_signed_link_base_url', function ( string $url, string $purpose, int $show_id ): string {
    $page = get_page_by_path( 'members' );

    return $page instanceof WP_Post ? get_permalink( $page ) : $url;
}, 10, 3 );

Notes

A refused link — expired, already spent, tampered with, or belonging to a deleted account — is redirected to this URL (or the home page) with benecaster_link_expired=1 appended. Benecaster prints nothing for that argument; it exists so a theme can.

A visitor arriving with benecaster_link_expired=1 is not logged in, so a custom landing page must not assume a session. And say only that the link no longer works: Benecaster deliberately gives every kind of refusal the same destination, because distinguishing "expired" from "already used" from "not a real link" tells someone holding a stolen or guessed token which part of it to work on.

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