WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/content url

Contents

Description

The content_url template tag retrieves the url to the content area for the current site with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise.

Usage

<?php content_url$path ); ?>

Default Usage

<?php $url content_url(); ?>

Parameters

$path
(string) (optional) Path relative to the content url.
Default: None

Return

(string) 
Content url link with optional path appended.

Examples

$url = content_url();
echo $url;

Output: http://www.example.com/wp-content (without end /)

Notes

  • Uses WP_CONTENT_URL;

Changelog

Source Code

content_url() is located in wp-includes/link-template.php.

Related

WordPress Directories:
home_url() Home URL http://www.example.com
site_url() Site directory URL http://www.example.com or http://www.example.com/wordpress
admin_url() Admin directory URL http://www.example.com/wp-admin
includes_url() Includes directory URL http://www.example.com/wp-includes
content_url() Content directory URL http://www.example.com/wp-content
plugins_url() Plugins directory URL http://www.example.com/wp-content/plugins
theme_url() Themes directory URL (#18302) http://www.example.com/wp-content/themes
wp_upload_dir() Upload directory URL (returns an array) http://www.example.com/wp-content/uploads
See also index of Function Reference and index of Template Tags.