Nahnu Fonts has 59 actions and filters, all prefixed nahnu_fonts_. Add your code from a small plugin or your child theme’s functions.php. To extend the plugin itself, start from nahnu_fonts_boot_end.
Common recipes
Preload more than 3 files:
◐
Copy
add_filter( 'nahnu_fonts_preload_limit', fn() => 4 );
Let editors manage fonts (default capability is manage_options):
◐
Copy
add_filter( 'nahnu_fonts_capability', fn() => 'edit_theme_options' );
Clear a cache Nahnu Fonts doesn’t know when fonts change:
◐
Copy
add_action( 'nahnu_fonts_after_purge_cache', function () {
if ( function_exists( 'my_host_purge_all' ) ) {
my_host_purge_all();
}
} );
Keep Google Fonts on in one builder only:
◐
Copy
add_filter( 'nahnu_fonts_builder_google_fonts_off', function ( $off, $integration ) {
return 'elementor' === $integration ? false : $off;
}, 10, 2 );
Add your own CSS to the stylesheet:
◐
Copy
add_filter( 'nahnu_fonts_css', function ( $css ) {
return $css . '.lead{font-family:var(--nahnu-font-inter);}';
} );
Plugin lifecycle (actions)
Hook Arguments When nahnu_fonts_boot_startnone Plugin starts loading (plugins_loaded) nahnu_fonts_boot_adminnone Loaded in the admin nahnu_fonts_boot_endnone Finished loading. Extend the plugin from here nahnu_fonts_activate_start / _endnone Around activation nahnu_fonts_deactivate_start / _endnone Around deactivation nahnu_fonts_upgrade_start / _end$from, $toOnce after the plugin version changes
Integrations
Hook Type Arguments nahnu_fonts_integrationsfilter array $integrations name to classnahnu_fonts_before_integrationsaction none nahnu_fonts_integrations_loadedaction Integration[] $runningnahnu_fonts_invalid_integrationaction $name, $classnahnu_fonts_block_editor_presetsfilter array $presets, array $familiesnahnu_fonts_builder_google_fonts_offfilter bool $off, string $integration
Settings
Hook Type Arguments nahnu_fonts_settingsfilter array $settings (when read)nahnu_fonts_pre_save_settingsfilter array $clean, array $current, array $inputnahnu_fonts_settings_savedaction array $saved, array $previousnahnu_fonts_capabilityfilter string $capability (default manage_options)
Font library
Hook Type Arguments nahnu_fonts_pre_save_fontfilter array $fontnahnu_fonts_font_savedaction array $font, bool $is_newnahnu_fonts_font_deletedaction array $fontnahnu_fonts_library_changedaction array $fontsnahnu_fonts_get_fontsfilter array $fonts, bool $include_inactive (public API output)
Google Fonts (Bunny or Google)
Hook Type Arguments nahnu_fonts_catalog_urlfilter string $url, string $providernahnu_fonts_catalogfilter array $list, string $providernahnu_fonts_catalog_cache_ttlfilter int $seconds (default one week), string $providernahnu_fonts_catalog_enable_updatefilter bool $enable, string $provider. Return false to use only the cached listnahnu_fonts_download_css_urlfilter string $url, string $provider, array $entry, array $argsnahnu_fonts_user_agentfilter string $user_agent, string $urlnahnu_fonts_google_font_savedaction array $font, string $provider, bool $updated
Custom fonts and Adobe Fonts
Hook Type Arguments nahnu_fonts_max_upload_sizefilter int $bytes (never above the server limit)nahnu_fonts_custom_font_savedaction array $font, string[] $filesnahnu_fonts_adobe_css_urlfilter string $url, string $project_idnahnu_fonts_adobe_connectedaction string $project_id, array $fontsnahnu_fonts_adobe_disconnectedaction none
Stylesheet build
Hook Type Arguments nahnu_fonts_build_fontsfilter array $fonts, array $settingsnahnu_fonts_cssfilter string $css, array $fonts, array $settings. $settings['context'] is admin-preview for the admin previewnahnu_fonts_preload_limitfilter int $limit (default 3)nahnu_fonts_build_warningaction string $messagenahnu_fonts_build_succeededaction array $build, bool $changednahnu_fonts_build_failedaction Throwable $error
Page cache
Hook Type Arguments nahnu_fonts_should_purge_cachefilter bool $purgenahnu_fonts_before_purge_cacheaction none nahnu_fonts_after_purge_cacheaction none. Clear caches Nahnu Fonts doesn’t know here
Front end
Hook Type Arguments nahnu_fonts_load_stylesheetfilter bool $loadnahnu_fonts_before_enqueue_styleaction array $buildnahnu_fonts_after_enqueue_styleaction array $buildnahnu_fonts_preload_resourcesfilter array $resourcesnahnu_fonts_blocked_font_hostsfilter string[] $hosts (default fonts.googleapis.com)nahnu_fonts_blocked_stylesfilter string[] $handles about to be removed
Import and export
Hook Type Arguments nahnu_fonts_export_fontsfilter array $fontsnahnu_fonts_importedaction int $count, array $manifest
Moving from Jooosi Fon
Hook Type Arguments nahnu_fonts_jooosi_migration_startaction none nahnu_fonts_jooosi_migration_endaction array $summary: imported, skipped, warnings
REST API
Hook Type Arguments nahnu_fonts_rest_routesfilter array $routes route to endpoints (add or change routes)nahnu_fonts_rest_registeredaction string $namespacenahnu_fonts_rest_invalid_routeaction $route, $endpointnahnu_fonts_rest_erroraction WP_Error $error, string $route, WP_REST_Request $request