content_url

Retrieves the URL to the content directory.

Description

(string) content_url( (string) $path = '' ); 

Returns (string)

Content URL link with optional path appended.

Parameters (1)

0. $path — Optional. (string) => ''
Path relative to the content URL. Default empty.

Usage

  1. if ( !function_exists( 'content_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Optional. Path relative to the content URL. Default empty. 
  5. $path = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = content_url($path); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/link-template.php  
  1. function content_url( $path = '' ) { 
  2.  
  3. if ( $path && is_string( $path ) ) 
  4. $url .= '/' . ltrim($path, '/'); 
  5.  
  6. /** 
  7. * Filters the URL to the content directory. 
  8. * @since 2.8.0 
  9. * @param string $url The complete URL to the content directory including scheme and path. 
  10. * @param string $path Path relative to the URL to the content directory. Blank string 
  11. * if no path is specified. 
  12. */ 
  13. return apply_filters( 'content_url', $url, $path);