WordPress开发者和主题制作者的搜索引擎



content_url ›

Since2.6.0
已弃用n/a
content_url ( $path = '' )
参数:
  • (string) $path Optional. Path relative to the content URL. Default empty.
    Required: No
    默认: (empty)
返回:
  • (string) Content URL link with optional path appended.
定义在:
文档:

Retrieves the URL to the content directory.



源码

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 );
}