Skip to main content

benecaster_erasure_request_output

Filter Free

Filters the HTML of [benecaster_erasure_request], and of the Erase my data section [benecaster_account] renders through the same class, in every state.

sent fires for every well-formed address, whether or not the site holds anything for it, whether a request was already open, and when the submission was throttled and nothing was filed. Don’t branch on whether the address is known: identical output is what stops the form being used to test which addresses are on file.

Parameters

Name Type Default Description
$html string — The rendered form or message.
$atts array — Resolved shortcode attributes (`button_label`).
$state string — `form` (first render), `sent` (after any well-formed address), or `error` (a malformed address, a failed Turnstile challenge, or a form left open long enough for its nonce to go stale).

Returns: string

Example

add_filter( 'benecaster_erasure_request_output', function ( string $html, array $atts, string $state ): string {
    if ( 'sent' === $state ) {
        return $html . '<p class="my-erasure-note">' . esc_html__( 'We aim to complete requests within 30 days.', 'my-theme' ) . '</p>';
    }
    return $html;
}, 10, 3 );

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