W3cubDocs

/WordPress

get_self_link(): string

Returns the link for the currently displayed feed.

Return

string Correct link for the atom:self element.

Source

function get_self_link() {
	$parsed = parse_url( home_url() );

	$domain = $parsed['host'];
	if ( isset( $parsed['port'] ) ) {
		$domain .= ':' . $parsed['port'];
	}

	return set_url_scheme( 'http://' . $domain . wp_unslash( $_SERVER['REQUEST_URI'] ) );
}

Changelog

Version Description
5.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_self_link