SafeFonts
by Chris Martens on WordPress.org
Host custom fonts locally in WordPress with advanced security validation and block editor integration.

SafeFonts admin interface - Upload and manage fonts
SafeFonts helps you comply with GDPR by hosting fonts locally and avoiding third-party requests, with seamless Gutenberg integration.
If you need to host custom fonts locally on your WordPress site for performance, privacy, or GDPR compliance, SafeFonts makes it simple with advanced security validation and automatic integration with the WordPress block editor.
Why Choose SafeFonts?
🔒 Security-First Approach
* Magic byte validation for all font files
* MIME type verification
* File hash checking
* Configurable file size limits
* Protection against malicious uploads
⚡ Fast & Lightweight
* Custom database storage for instant queries
* Designed to minimize impact on page load speed
* Optimized font delivery
* Works with any theme or page builder
✅ Gutenberg Integration
* Automatic integration with block editor typography
* WordPress 6.5+ Font Library support
* Works with all blocks that support typography
* No configuration needed
🎯 Simple Upload Process
* Individual font file uploads (.woff2, .woff, .ttf, .otf)
* Specify font family, weight, and style
* Visual font previews in admin
* Drag-and-drop ready interface
⚡ Performance Optimization
* Font preloading support for faster page loads
* Automatic preload tag generation:
* User-selectable fonts for preloading (Settings tab)
* Best practice: Preload 1-2 critical fonts only
* Reduces flash of invisible text (FOIT)
* Improves Core Web Vitals scores
🌍 GDPR Compliant
* Local font hosting
* No external font requests—fonts are served entirely from your WordPress installation
* Complete data privacy
* Suitable for GDPR-compliant sites
Perfect For
- Privacy-conscious websites requiring GDPR compliance
- Sites that need custom or premium fonts
- Agencies managing multiple client sites
- Anyone wanting better control over typography
- Performance-optimized websites
How It Works
- Upload Fonts: Go to SafeFonts menu and upload your font files
- Configure Details: Set font family name, weight (100-900), and style (normal/italic)
- Use in Gutenberg: Your fonts automatically appear in the block editor
- That’s It! Fonts are served locally with optimal performance
Getting Google Fonts
Download Google Fonts from these sources:
- SafeFonts Web Font Downloader – convenient bulk download tool
- Google Fonts GitHub – official repository
- Google Webfonts Helper – third-party download tool
Once downloaded, upload the font files (.woff2, .woff, .ttf, .otf) through SafeFonts > Upload tab.
Need more features? SafeFonts Pro offers bulk ZIP imports, page builder integration, and advanced font management. Learn more
Supported Font Formats
- WOFF2 (recommended – best compression)
- WOFF (broad browser support)
- TTF (TrueType fonts)
- OTF (OpenType fonts)
WordPress 6.5+ Font Library
If you’re using WordPress 6.5 or higher, SafeFonts automatically integrates with the native Font Library in the Site Editor, giving you a unified font management experience.
Developer Documentation
Template Functions
SafeFonts provides helper functions for developers:
safefonts() - Get the main plugin instance
safefonts()->font_manager->get_fonts() - Get all fonts from database
safefonts()->font_manager->get_fonts_by_family() - Get fonts grouped by family
Hooks & Filters
Filters:
* upload_mimes – SafeFonts adds font MIME types automatically
Database Structure
Table: wp_chrmrtns_safefonts
* id – Font ID
* font_family – Font family name
* family_slug – Sanitized family slug for folder names (v1.1.0+)
* font_style – normal or italic
* font_weight – 100-900
* file_path – Relative path to font file (includes family folder v1.1.0+)
* file_hash – SHA-256 hash for integrity
* file_size – File size in bytes
* mime_type – Validated MIME type
* created_at – Upload timestamp
* updated_at – Last update timestamp
Architecture
SafeFonts uses modern PHP namespaces and PSR-4 autoloading:
* Chrmrtns\SafeFonts\Core – Main plugin class
* Chrmrtns\SafeFonts\FontManager – Font validation and management
* Chrmrtns\SafeFonts\Admin\AdminInterface – Admin UI
Support
For support, feature requests, or bug reports, please visit:
* GitHub
* Website
Privacy Policy
SafeFonts does not collect, store, or transmit any personal data. All font files are stored locally on your WordPress installation. No data is sent to external services.