The includes_url() WordPress PHP function retrieves the URL to the includes directory.
Usage
$url = includes_url($path = '', $scheme = null);
Parameters
$path(string) – Optional. Path relative to the includes URL. Default:''$scheme(string|null) – Optional. Scheme to give the includes URL context. Accepts ‘http’, ‘https’, or ‘relative’. Default:null
More information
See WordPress Developer Resources: includes_url()
Examples
Get the default includes URL
This example retrieves the default includes URL.
$url = includes_url();
echo $url; // Outputs: https://{domain}/wp-includes
Get the includes URL with HTTPS scheme
This example retrieves the includes URL with an HTTPS scheme.
$url = includes_url('', 'https');
echo $url; // Outputs: https://{domain}/wp-includes
Get the includes URL with HTTP scheme
This example retrieves the includes URL with an HTTP scheme.
$url = includes_url('', 'http');
echo $url; // Outputs: http://{domain}/wp-includes
Get the includes URL with a relative scheme
This example retrieves the includes URL with a relative scheme.
$url = includes_url('', 'relative');
echo $url; // Outputs: /wp-includes/
Get the includes URL for a specific file
This example retrieves the includes URL for a specific file in the includes directory.
$file_path = 'js/jquery/jquery.js';
$url = includes_url($file_path);
echo $url; // Outputs: https://{domain}/wp-includes/js/jquery/jquery.js