content_url( string $path = '' ): string
- Since
- 2.6.0
- Source
wp-includes/link-template.php:3642
Retrieves the URL to the content directory.
Parameters
$pathstringoptional- Path relative to the content URL. Default empty.Default:
''
Return
string- Content URL link with optional path appended.
Hooks fired · 1
One hook fires while content_url() runs, in this order:
- apply_filters( content_url )filterline 3658 (+16 into the body)
Filters the URL to the content directory.
Uses · 2
- set_url_scheme()Sets the scheme for a URL.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 4
- WP_URL_Pattern_Prefixer::get_default_contexts()Returns the default contexts used by the class.
- _WP_Editors::editor_settings()
- get_theme_root_uri()Retrieves URI for themes directory.
- load_script_textdomain()Loads the script translated strings.
Source
function content_url( $path = '' ) { $url = set_url_scheme( WP_CONTENT_URL ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } /** * Filters the URL to the content directory. * * @since 2.8.0 * * @param string $url The complete URL to the content directory including scheme and path. * @param string $path Path relative to the URL to the content directory. Blank string * if no path is specified. */ return apply_filters( 'content_url', $url, $path );}History
Introduced in 2.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/link-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.