get_self_link() WordPress Function

The get_self_link() function in WordPress allows you to get the URL of the current page. This is useful for creating links back to the current page, or for creating links to other pages on your site.

get_self_link() #

Returns the link for the currently displayed feed.


Return

(string) Correct link for the atom:self element.


Top ↑

Source

File: wp-includes/feed.php

function get_self_link() {
	$host = parse_url( home_url() );
	return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) );
}


Top ↑

Changelog

Changelog
VersionDescription
5.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.