Docs

Hooks

2 min readUpdated October 28, 2026

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:

add_filter( 'nahnu_fonts_preload_limit', fn() => 4 );

Let editors manage fonts (default capability is manage_options):

add_filter( 'nahnu_fonts_capability', fn() => 'edit_theme_options' );

Clear a cache Nahnu Fonts doesn’t know when fonts change:

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:

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:

add_filter( 'nahnu_fonts_css', function ( $css ) {
	return $css . '.lead{font-family:var(--nahnu-font-inter);}';
} );

Plugin lifecycle (actions)#

HookArgumentsWhen
nahnu_fonts_boot_startnonePlugin starts loading (plugins_loaded)
nahnu_fonts_boot_adminnoneLoaded in the admin
nahnu_fonts_boot_endnoneFinished loading. Extend the plugin from here
nahnu_fonts_activate_start / _endnoneAround activation
nahnu_fonts_deactivate_start / _endnoneAround deactivation
nahnu_fonts_upgrade_start / _end$from, $toOnce after the plugin version changes

Integrations#

HookTypeArguments
nahnu_fonts_integrationsfilterarray $integrations name to class
nahnu_fonts_before_integrationsactionnone
nahnu_fonts_integrations_loadedactionIntegration[] $running
nahnu_fonts_invalid_integrationaction$name, $class
nahnu_fonts_block_editor_presetsfilterarray $presets, array $families
nahnu_fonts_builder_google_fonts_offfilterbool $off, string $integration

Settings#

HookTypeArguments
nahnu_fonts_settingsfilterarray $settings (when read)
nahnu_fonts_pre_save_settingsfilterarray $clean, array $current, array $input
nahnu_fonts_settings_savedactionarray $saved, array $previous
nahnu_fonts_capabilityfilterstring $capability (default manage_options)

Font library#

HookTypeArguments
nahnu_fonts_pre_save_fontfilterarray $font
nahnu_fonts_font_savedactionarray $font, bool $is_new
nahnu_fonts_font_deletedactionarray $font
nahnu_fonts_library_changedactionarray $fonts
nahnu_fonts_get_fontsfilterarray $fonts, bool $include_inactive (public API output)

Google Fonts (Bunny or Google)#

HookTypeArguments
nahnu_fonts_catalog_urlfilterstring $url, string $provider
nahnu_fonts_catalogfilterarray $list, string $provider
nahnu_fonts_catalog_cache_ttlfilterint $seconds (default one week), string $provider
nahnu_fonts_catalog_enable_updatefilterbool $enable, string $provider. Return false to use only the cached list
nahnu_fonts_download_css_urlfilterstring $url, string $provider, array $entry, array $args
nahnu_fonts_user_agentfilterstring $user_agent, string $url
nahnu_fonts_google_font_savedactionarray $font, string $provider, bool $updated

Custom fonts and Adobe Fonts#

HookTypeArguments
nahnu_fonts_max_upload_sizefilterint $bytes (never above the server limit)
nahnu_fonts_custom_font_savedactionarray $font, string[] $files
nahnu_fonts_adobe_css_urlfilterstring $url, string $project_id
nahnu_fonts_adobe_connectedactionstring $project_id, array $fonts
nahnu_fonts_adobe_disconnectedactionnone

Stylesheet build#

HookTypeArguments
nahnu_fonts_build_fontsfilterarray $fonts, array $settings
nahnu_fonts_cssfilterstring $css, array $fonts, array $settings. $settings['context'] is admin-preview for the admin preview
nahnu_fonts_preload_limitfilterint $limit (default 3)
nahnu_fonts_build_warningactionstring $message
nahnu_fonts_build_succeededactionarray $build, bool $changed
nahnu_fonts_build_failedactionThrowable $error

Page cache#

HookTypeArguments
nahnu_fonts_should_purge_cachefilterbool $purge
nahnu_fonts_before_purge_cacheactionnone
nahnu_fonts_after_purge_cacheactionnone. Clear caches Nahnu Fonts doesn’t know here

Front end#

HookTypeArguments
nahnu_fonts_load_stylesheetfilterbool $load
nahnu_fonts_before_enqueue_styleactionarray $build
nahnu_fonts_after_enqueue_styleactionarray $build
nahnu_fonts_preload_resourcesfilterarray $resources
nahnu_fonts_blocked_font_hostsfilterstring[] $hosts (default fonts.googleapis.com)
nahnu_fonts_blocked_stylesfilterstring[] $handles about to be removed

Import and export#

HookTypeArguments
nahnu_fonts_export_fontsfilterarray $fonts
nahnu_fonts_importedactionint $count, array $manifest

Moving from Jooosi Fon#

HookTypeArguments
nahnu_fonts_jooosi_migration_startactionnone
nahnu_fonts_jooosi_migration_endactionarray $summary: imported, skipped, warnings

REST API#

HookTypeArguments
nahnu_fonts_rest_routesfilterarray $routes route to endpoints (add or change routes)
nahnu_fonts_rest_registeredactionstring $namespace
nahnu_fonts_rest_invalid_routeaction$route, $endpoint
nahnu_fonts_rest_erroractionWP_Error $error, string $route, WP_REST_Request $request