get_post_type_archive_feed_link

Definition:
function get_post_type_archive_feed_link( $post_type, $feed = '' ) {}

Retrieve the permalink for a post type archive feed.

Parameters

  • string $post_type: Post type
  • string $feed: Optional. Feed type

Defined filters

  • post_type_archive_feed_link
    apply_filters( 'post_type_archive_feed_link', $link, $feed )

Source code

function get_post_type_archive_feed_link( $post_type, $feed = '' ) {

	$default_feed = get_default_feed();

	if ( empty( $feed ) )

		$feed = $default_feed;



	if ( ! $link = get_post_type_archive_link( $post_type ) )

		return false;

	$post_type_obj = get_post_type_object( $post_type );

	if ( $post_type_obj->rewrite['feeds'] && get_option( 'permalink_structure' ) ) {

		$link = trailingslashit($link);

		$link .= 'feed/';

		if ( $feed != $default_feed )

			$link .= "$feed/";

	} else {

		$link = add_query_arg( 'feed', $feed, $link );

	}



	return apply_filters( 'post_type_archive_feed_link', $link, $feed );

}

9612

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: