wpmem_current_url()

Description

This function returns the url of the current page.

The function does not echo output.  Since it returns a string, this can be used for comparisons.

Parameters

$slash
(boolean)(optional) Add trailing slash to the current URL (Default: true)

$getq
(boolean)(optional) Get the query string (if one exists) (Default: true)

Return Values

(string) The URL of the current page.

Examples

Compare the current page to see if we are on the login page (using wpmem_login_url()):

[gist id=”71999f4cb8ec461f56fc2263e2b131bb” file=”wpmem_login_url_compare.php”]

Changelog

  • Introduced in version 3.1.1
  • Added check for query string in 3.1.7

Source

wpmem_current_url() is located in /includes/api/api.php.