N Docs
← Back to site

Filters

2 min readUpdated November 23, 2026
FilterArgumentsUse
nahnu_links_link_data$data, $client_id, $link_idBefore a link is made ($link_id 0) or changed in WordPress. Return changed data, or a WP_Error to refuse.
nahnu_links_client_data$data, $client_idThe same for clients.
nahnu_links_event_data$data, $type, $client_idWhat an event carries.
nahnu_links_skip_eventfalse, $type, $data, $client_idReturn true to drop an event.
nahnu_links_event_types$typesThe list of events. Add your custom.* types so they show on the Developers page.
nahnu_links_webhook_payload$payload, $webhookThe body of one delivery.
nahnu_links_webhook_retries[ 60, 300, 1800, 7200, 21600, 43200, 86400 ]Seconds before each retry.
nahnu_links_webhook_timeout8Seconds to wait for an answer.
nahnu_links_event_days30Days events and deliveries are kept.
nahnu_links_short_url$url, $linkThe address shown for a link.
add_filter( 'nahnu_links_link_data', function ( $data, $client_id, $link_id ) {
    if ( str_contains( $data['destination_url'] ?? '', 'competitor.com' ) ) {
        return new WP_Error( 'not_allowed', 'Links to that site are not allowed.' );
    }
    return $data;
}, 10, 3 );

The edge script on Bunny can’t run PHP, so filters don’t change how redirects work, and they apply to changes made in WordPress. Changes made through the API on Bunny reach you as events.

More examples#

Always add UTM tags to links made in WordPress

add_filter( 'nahnu_links_link_data', function ( $data ) {
    if ( ! empty( $data['destination_url'] ) && ! str_contains( $data['destination_url'], 'utm_source=' ) ) {
        $data['destination_url'] = add_query_arg( 'utm_source', 'shortlink', $data['destination_url'] );
    }
    return $data;
} );

Register your own event type

add_filter( 'nahnu_links_event_types', function ( $types ) {
    $types['custom.campaign_sent'] = 'A campaign was sent';
    return $types;
} );

// Later:
nahnu_links_emit_event( 'custom.campaign_sent', [ 'campaign' => 'spring' ], $client_id );

Retry webhooks for longer

add_filter( 'nahnu_links_webhook_retries', fn() => [ 60, 300, 1800, 7200, 21600, 43200, 86400, 172800 ] );

Keep events for 90 days

add_filter( 'nahnu_links_event_days', fn() => 90 );

Where filters apply#

Change made inFilters run?
The WordPress dashboardYes
PHP functionsYes
The client dashboard and AI assistantsYes
The client or partner API, client sitesNo: these run on Bunny. You get the events instead.