includes_url() WP 2.6.0
Retrieves the URL to the wp-includes directory with the appropriate protocol: 'https' or 'http'.
The function adds https
to the URL if is_ssl() returns true, in other cases it adds http
.
It's better to use this function instead of the hardcoded path to wp-includes because WordPress can be moved to a subdirectory.
Uses WPINC constant.
1 time = 0.003941s = very slow | 50000 times = 2.29s = fast | PHP 7.2.16, WP 5.2
Hooks from the function
Return
String. Includes URL link with optional path appended.
Usage
includes_url( $path, $scheme );
- $path(string)
- Path relative to the includes URL.
Default: '' - $scheme(string)
- Scheme to give the includes URL context. Accepts 'http', 'https', or 'relative'.
Default: null
Examples
#1 Basic usage
$url = includes_url(); echo $url; // Output: http://wp-kama.com/wp-includes/
Changelog
Since 2.6.0 | Introduced. |
Code of includes_url() includes url WP 5.6
function includes_url( $path = '', $scheme = null ) {
$url = site_url( '/' . WPINC . '/', $scheme );
if ( $path && is_string( $path ) ) {
$url .= ltrim( $path, '/' );
}
/**
* Filters the URL to the includes directory.
*
* @since 2.8.0
*
* @param string $url The complete URL to the includes directory including scheme and path.
* @param string $path Path relative to the URL to the wp-includes directory. Blank string
* if no path is specified.
*/
return apply_filters( 'includes_url', $url, $path );
}Related Functions
From tag: Link (URL)
- admin_url()
- attachment_url_to_postid()
- build_query()
- comment_link()
- content_url()
- get_comments_link()
- get_comments_pagenum_link()
- get_edit_post_link()
- get_edit_term_link()
- get_home_url()
- get_next_comments_link()
- get_post_embed_url()
- get_post_permalink()