WordPress.org

Ready to get started?Download WordPress

Codex

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

Difference between revisions of "Function Reference/set url scheme"

m (Changelog: Link version 3.5)
(Include more information about the function)
Line 1: Line 1:
 
== Description ==
 
== Description ==
+
Set the scheme for a URL.
 
== Usage ==
 
== Usage ==
   
%%% <?php ?> %%%
+
%%% <?php $url_with_scheme = set_url_scheme( $url, $scheme ) ?> %%%
   
 
== Parameters ==
 
== Parameters ==
  +
{{Parameter|$url|string|Absolute url that includes a scheme.}}
  +
{{Parameter|$scheme|string|Scheme to give <tt>$url</tt>. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. If omitted or <tt>null</tt>, will default to 'http' or 'https' based on whether [[Function Reference/is ssl|is_ssl()]].|optional|null}}
  +
  +
== Return Value ==
  +
  +
{{Return|$url|string|URL with chosen scheme.}}
   
 
== Examples ==
 
== Examples ==
Line 17: Line 23:
 
== Source File ==
 
== Source File ==
   
<tt> </tt> is located in {{Trac| }}
+
<tt>set_url_scheme()</tt> is located in {{Trac|wp-includes/link-template.php}}
   
 
== Related ==
 
== Related ==

Revision as of 17:50, 12 December 2012

Description

Set the scheme for a URL.

Usage

 <?php $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

Change Log

Source File

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

Related