wppaste
WordPress

content_url( string $path = '' ): string

Since
2.6.0
Source
wp-includes/link-template.php:3651
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:

  1. apply_filters( content_url )filterline 3667 (+16 into the body)

    Filters the URL to the content directory.

Uses · 2

Used by · 4

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 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.