Advertisements

get_post_comments_feed_link

Definition:
function get_post_comments_feed_link($post_id = 0, $feed = '') {}

Retrieve the permalink for the post comments feed.

Parameters

  • int $post_id: Optional. Post ID.
  • string $feed: Optional. Feed type.

Defined filters

  • post_comments_feed_link
    apply_filters('post_comments_feed_link', $url)

Source code

function get_post_comments_feed_link($post_id = 0, $feed = '') {

	$post_id = absint( $post_id );



	if ( ! $post_id )

		$post_id = get_the_ID();



	if ( empty( $feed ) )

		$feed = get_default_feed();



	if ( '' != get_option('permalink_structure') ) {

		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )

			$url = _get_page_link( $post_id );

		else

			$url = get_permalink($post_id);



		$url = trailingslashit($url) . 'feed';

		if ( $feed != get_default_feed() )

			$url .= "/$feed";

		$url = user_trailingslashit($url, 'single_feed');

	} else {

		$type = get_post_field('post_type', $post_id);

		if ( 'page' == $type )

			$url = home_url("?feed=$feed&page_id=$post_id");

		else

			$url = home_url("?feed=$feed&p=$post_id");

	}



	return apply_filters('post_comments_feed_link', $url);

}

1583

Advertisements

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: