get_feed_link

Definition:
function get_feed_link($feed = '') {}

Retrieve the permalink for the feed type.

Parameters

  • string $feed: Optional, defaults to default feed. Feed type.

Source code

function get_feed_link($feed = '') {

	global $wp_rewrite;



	$permalink = $wp_rewrite->get_feed_permastruct();

	if ( '' != $permalink ) {

		if ( false !== strpos($feed, 'comments_') ) {

			$feed = str_replace('comments_', '', $feed);

			$permalink = $wp_rewrite->get_comment_feed_permastruct();

		}



		if ( get_default_feed() == $feed )

			$feed = '';



		$permalink = str_replace('%feed%', $feed, $permalink);

		$permalink = preg_replace('#/+#', '/', "/$permalink");

		$output =  home_url( user_trailingslashit($permalink, 'feed') );

	} else {

		if ( empty($feed) )

			$feed = get_default_feed();



		if ( false !== strpos($feed, 'comments_') )

			$feed = str_replace('comments_', 'comments-', $feed);



		$output = home_url("?feed={$feed}");

	}

1388

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: