W3cubDocs

/WordPress

wp_font_dir( bool $create_dir = true ): array

Returns an array containing the current fonts upload directory’s path and URL.

Parameters

$create_dirbooloptional
Whether to check and create the font uploads directory.

Default:true

Return

array Array of information about the font upload directory.
  • path string
    Base directory and subdirectory or full path to the fonts upload directory.
  • url string
    Base URL and subdirectory or absolute URL to the fonts upload directory.
  • subdir string
    Subdirectory
  • basedir string
    Path without subdir.
  • baseurl string
    URL path without subdir.
  • error string|false
    False or error message.

Source

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;
}

Changelog

Version Description
6.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_font_dir