Action & Filter Hooks
WP LinkCanvas provides a set of filters that let developers customise behaviour without modifying plugin files. All hooks are prefixed with nlb_.
Icon registry#
nlb_icons#
Filters the full icon registry used for social icons and link icons. Use this to add platforms not in the built-in set — Fansly, Ko-fi, Buy Me a Coffee, Chaturbate, or any custom icon.
Parameters:
$icons(array) — the current icon registry
Returns: array — the modified icon registry
Each entry must have label, group, and either fa (Font Awesome class string) or svg (inline SVG string). Valid group values are generic, creator, and brand.
php
add_filter( 'nlb_icons', function( $icons ) {
$icons['fansly'] = [
'label' => 'Fansly',
'group' => 'creator',
'svg' => '<svg viewBox="0 0 24 24" fill="currentColor">...</svg>',
];
return $icons;
} );
To use a Font Awesome brand icon instead of inline SVG:
php
$icons['ko-fi'] = [
'label' => 'Ko-fi',
'group' => 'creator',
'fa' => 'fa-brands fa-ko-fi',
];
SEO#
nlb_seo_title#
Filters the SEO title for a bio page before it is injected into the active SEO plugin. Fires after the per-language value has been read from the editor.
Parameters:
$title(string) — the resolved per-language SEO title (empty string if not set)$post_id(int) — the bio page post ID$lang_code(string) — the current language code (e.g.en,ar)
Returns: string
php
add_filter( 'nlb_seo_title', function( $title, $post_id, $lang_code ) {
if ( ! $title ) {
return get_the_title( $post_id ) . ' | My Site';
}
return $title;
}, 10, 3 );
nlb_seo_description#
Filters the meta description for a bio page. Same signature as nlb_seo_title.
Parameters:
$description(string)$post_id(int)$lang_code(string)
Returns: string
nlb_seo_image#
Filters the Open Graph image URL for a bio page. Falls back to the avatar if not set in the editor.
Parameters:
$image(string) — resolved image URL or empty string$post_id(int)$lang_code(string)
Returns: string — a valid image URL or empty string
Geo detection#
nlb_detect_country#
Filters the detected country code after all detection methods have run. Use this to override the detected country for testing or to apply custom logic.
Parameters:
$code(string) — the two-letter ISO country code (e.g.US,AE), or empty string if detection failed
Returns: string
php
add_filter( 'nlb_detect_country', function( $code ) {
// Force all visitors to AE for testing.
return 'AE';
} );
nlb_country_fallback#
Filters the fallback country code used when geo detection fails or returns no result. The fallback is passed to the frontend so geo rules still apply when the API is unavailable.
Parameters:
$fallback(string) — default empty string (no fallback)$lang_code(string) — the current language code
Returns: string — a two-letter country code or empty string
nlb_country_name#
Filters the human-readable name for a country code. Used in the geo targeting country picker in the editor.
Parameters:
$default(string) — the default translated country name$code(string) — the two-letter country code$lang_code(string) — the language the name is being rendered in
Returns: string
Embed system#
nlb_embed_providers#
Filters the full embed provider registry. Use this to add support for a platform not in the built-in list, or to modify an existing provider’s URL patterns or embed template.
Parameters:
$providers(array) — the current provider registry
Returns: array
Each provider entry requires at minimum a name key and patterns array of regex strings. See the plugin source for the full entry format.
php
add_filter( 'nlb_embed_providers', function( $providers ) {
$providers['my-platform'] = [
'name' => 'My Platform',
'patterns' => [ '#myplatform\.com/video/([0-9]+)#i' ],
'embed' => 'https://myplatform.com/embed/{id}',
];
return $providers;
} );
nlb_embed_data#
Filters the auto-fill data returned when a URL is pasted in the editor and the fetch button is clicked. Fires after the provider has resolved title, thumbnail, and embed HTML.
Parameters:
$data(array) — keys:title,thumbnail,embed_html,subtitle,provider$url(string) — the source URL
Returns: array
nlb_embed_iframe_allowed_hosts#
Filters the allowlist of iframe src domains that survive embed sanitisation. Any <iframe> pointing to a host not on this list is stripped when saving. Subdomain matching is automatic — adding wistia.net also allows fast.wistia.net, embed.wistia.net, etc.
Parameters:
$hosts(array) — array of allowed hostname strings
Returns: array
php
add_filter( 'nlb_embed_iframe_allowed_hosts', function( $hosts ) {
$hosts[] = 'player.mycdn.com';
return $hosts;
} );
Theme presets#
nlb_theme_presets#
Filters the complete theme preset registry. Use this to register additional preset themes that appear in the Theme section of the bio page editor.
Parameters:
$presets(array) — the current preset registry
Returns: array
Each preset requires label, sample (4-item colour array for the swatch preview), and tokens (a full token map). The easiest approach is to copy an existing preset and modify its values.