bricks_upload_font
Overview
Uploads a custom web font to Bricks Builder, creating a font family with @font-face variants for different weight and style combinations. Supports woff2 (recommended), woff, ttf, otf, and eot formats.
After uploading, the font becomes available in typography font-family dropdowns throughout Bricks and can be referenced in theme styles, global classes, and inline typography settings.
Each font can have multiple variants (e.g., 400 normal, 400 italic, 700 normal, 700 italic) with files provided as URLs to the font assets.
Key Features
When to Use
Uploading self-hosted fonts for GDPR compliance (avoiding Google Fonts CDN)
Adding icon fonts or specialty display fonts
When the design requires specific font weights or styles not available in standard web fonts
At minimum, provide a woff2 file for each variant
Font files should be legally licensed for web use
When NOT to Use
When using Adobe Fonts/Typekit (use bricks_set_adobe_fonts instead)
When using system/web-safe fonts (no upload needed)
Parameters
font_familystringREQUIREDfont_displaystringoptionalswap Values: swap, auto, block, fallback, optionalvariantsarrayREQUIREDCode Examples
Upload a custom font with two weights
Upload a brand font with regular (400) and bold (700) variants in woff2 format.
{
"font_family": "BrandFont",
"font_display": "swap",
"variants": [
{
"weight": "400",
"style": "normal",
"files": {
"woff2": "https://example.com/fonts/brandfont-regular.woff2",
"woff": "https://example.com/fonts/brandfont-regular.woff"
}
},
{
"weight": "700",
"style": "normal",
"files": {
"woff2": "https://example.com/fonts/brandfont-bold.woff2",
"woff": "https://example.com/fonts/brandfont-bold.woff"
}
},
{
"weight": "400",
"style": "italic",
"files": {
"woff2": "https://example.com/fonts/brandfont-italic.woff2"
}
}
]
}{
"success": true,
"font_id": "d4e5f6",
"font_family": "BrandFont",
"message": "Font 'BrandFont' created with 3 variants."
}Common Mistakes
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Tips & Warnings
Tip: Use font-display: "swap" (the default) for best performance. This shows fallback text immediately and swaps to the custom font once loaded, avoiding invisible text during loading.
Tip: For GDPR compliance, self-host fonts instead of using Google Fonts CDN. Upload the font files to your media library first using bricks_upload_media, then reference those URLs.
Warning: Ensure you have proper licensing for web use. Some fonts have restrictions on self-hosting or embedding.