No results found. Try again with different words?

Search must be at least 3 characters.

    Filter to Add a New Custom Font

    Docs » Developers » Filter to Add a New Custom Font

    The cp_add_custom_fonts filter allows adding Custom font to existing font list.

    You just need to add the following code snippet in your theme’s functions.php file.

    Usage

    // Filter callback function
    function example_callback( $fonts ) {
          // update fonts here
       return $fonts;
    }
    
    add_filter( 'cp_add_custom_fonts', 'example_callback', 10 );

    Example

    /**
    * Add Custom Font "Mogra" to existing font list
    *
    * @param array $fonts
    * @return array
    */
    function custom_font_callback( $fonts ) {
       // Here Mogra is font family and 400 is font weight
       $fonts["Mogra"] = array(
           "400"
       );
    
       return $fonts;
    }
    
    add_filter( 'cp_add_custom_fonts', 'custom_font_callback', 10 );

    Note: Make sure font family and weight are correct to apply font.

    Was this article helpful?

    Did not find a solution? We are here to help you succeed.

    Related Docs

    Compare Convert Pro with...

    29439
    29440
    Scroll to Top