A WordPress-centric search engine for devs and theme authors



get_post_type_archive_feed_link ›

Since3.1.0
Deprecatedn/a
get_post_type_archive_feed_link ( $post_type, $feed = '' )
Parameters: (2)
  • (string) $post_type Post type
    Required: Yes
  • (string) $feed Optional. Feed type. Default empty.
    Required: No
    Default: (empty)
Returns:
  • (string|false) The post type feed permalink.
Defined at:
Codex:

Retrieves the permalink for a post type archive feed.



Source

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 ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
		$link = trailingslashit( $link );
		$link .= 'feed/';
		if ( $feed != $default_feed )
			$link .= "$feed/";
	} else {
		$link = add_query_arg( 'feed', $feed, $link );
	}

	/**
	 * Filters the post type archive feed link.
	 *
	 * @since 3.1.0
	 *
	 * @param string $link The post type archive feed link.
	 * @param string $feed Feed type.
	 */
	return apply_filters( 'post_type_archive_feed_link', $link, $feed );
}