content_url( string $path = '' )
Retrieves the URL to the content directory.
Description Description
Parameters Parameters
- $path
-
(string) (Optional) Path relative to the content URL.
Default value: ''
Return Return
(string) Content URL link with optional path appended.
Source Source
File: wp-includes/link-template.php
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 );
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.6.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
Output: http://www.example.com/wp-content (without a trailing /)