WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/set url scheme

Description

Set the scheme for a URL.

Usage

$url_with_scheme = set_url_scheme( $url, $scheme );

Parameters

$url
(string) (required) Absolute url that includes a scheme.
Default: None
$scheme
(string) (optional) Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. If omitted or null, will default to 'http' or 'https' based on whether is_ssl().
Default: null

Return Value

$url (string) 
URL with chosen scheme.

Examples

Default Usage

Notes

Applies the filter set_url_scheme to the return value, passing $url (URL set in function), $scheme (scheme set in function), and $orig_scheme (the scheme passed into set_url_scheme())

Change Log

Source File

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

Related