wp_font_dir

The timeline below displays how wordpress function wp_font_dir has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Returns an array containing the current fonts upload directory's path and URL.
 *
 * @since 6.5.0
 *
 * @param bool $create_dir Optional. Whether to check and create the font uploads directory. Default true.
 * @return array {
 *     Array of information about the font upload directory.
 *
 *     @type string       $path    Base directory and subdirectory or full path to the fonts upload directory.
 *     @type string       $url     Base URL and subdirectory or absolute URL to the fonts upload directory.
 *     @type string       $subdir  Subdirectory
 *     @type string       $basedir Path without subdir.
 *     @type string       $baseurl URL path without subdir.
 *     @type string|false $error   False or error message.
 * }
 */
function wp_font_dir($create_dir = true)
{
    /*
     * Allow extenders to manipulate the font directory consistently.
     *
     * Ensures the upload_dir filter is fired both when calling this function
     * directly and when the upload directory is filtered in the Font Face
     * REST API endpoint.
     */
    add_filter('upload_dir', '_wp_filter_font_directory');
    $font_dir = wp_upload_dir(null, $create_dir, false);
    remove_filter('upload_dir', '_wp_filter_font_directory');
    return $font_dir;
}