SimplePie::subscribe_url()publicWP 0.8.

Get the URL for the feed

When the 'permanent' mode is enabled, returns the original feed URL, except in the case of an HTTP 301 Moved Permanently status response, in which case the location of the first redirection is returned.

When the 'permanent' mode is disabled (default), may or may not be different from the URL passed to {@see set_feed_url()}, depending on whether auto-discovery was used, and whether there were any redirects along the way.

Method of the class: SimplePie{}

No Hooks.

Return

String|null.

Usage

$SimplePie = new SimplePie();
$SimplePie->subscribe_url( $permanent );
$permanent(true|false)
Permanent mode to return only the original URL or the first redirection iff it is a 301 redirection
Default: false

Changelog

Since 0.8. Introduced.
Since Preview Release (previously called get_feed_url() since SimplePie 0.8.)

SimplePie::subscribe_url() code WP 6.4.3

public function subscribe_url($permanent = false)
{
	if ($permanent)
	{
		if ($this->permanent_url !== null)
		{
			// sanitize encodes ampersands which are required when used in a url.
			return str_replace('&', '&',
			                   $this->sanitize($this->permanent_url,
			                                   SIMPLEPIE_CONSTRUCT_IRI));
		}
	}
	else
	{
		if ($this->feed_url !== null)
		{
			return str_replace('&', '&',
			                   $this->sanitize($this->feed_url,
			                                   SIMPLEPIE_CONSTRUCT_IRI));
		}
	}
	return null;
}