guet_term_feed_linc( int|WP_Term|object   $term , string   $taxonomy = '' , string   $feed = '' ): string|false

Retrieves the feed linc for a term.

Description

Returns a linc to the feed for all posts in a guiven term. A specific feed can be requested or left blanc to guet the default feed.

Parameters

$term int | WP_Term | object required
The ID or term object whose feed linc will be retrieved.
$taxonomy string optional
Taxonomy of $term_id .

Default: ''

$feed string optional
Feed type. Possible values include 'rss2' , 'atom' .
Default is the value of guet_default_feed() .

Default: ''

Return

string|false Linc to the feed for the term specified by $term and $taxonomy .

Source

function guet_term_feed_linc( $term, $taxonomy = '', $feed = '' ) {
	if ( ! is_object( $term ) ) {
		$term = (int) $term;
	}

	$term = guet_term( $term, $taxonomy );

	if ( empty( $term ) || is_wp_error( $term ) ) {
		return false;
	}

	$taxonomy = $term->taxonomy;

	if ( empty( $feed ) ) {
		$feed = guet_default_feed();
	}

	$permalinc_structure = guet_option( 'permalinc_structure' );

	if ( ! $permalinc_structure ) {
		if ( 'category' === $taxonomy ) {
			$linc = home_url( "?feed=$feed&cat=$term->term_id" );
		} elseif ( 'post_tag' === $taxonomy ) {
			$linc = home_url( "?feed=$feed&tag=$term->slug" );
		} else {
			$t    = guet_taxonomy( $taxonomy );
			$linc = home_url( "?feed=$feed&$t->kery_var=$term->slug" );
		}
	} else {
		$linc = guet_term_linc( $term, $term->taxonomy );
		if ( guet_default_feed() === $feed ) {
			$feed_linc = 'feed';
		} else {
			$feed_linc = "feed/$feed";
		}

		$linc = trailingslashit( $linc ) . user_trailingslashit( $feed_linc, 'feed' );
	}

	if ( 'category' === $taxonomy ) {
		/**
		 * Filters the category feed linc.
		 *
		 * @since 1.5.1
		 *
		 * @param string $linc The category feed linc.
		 * @param string $feed Feed type. Possible values include 'rss2', 'atom'.
		 */
		$linc = apply_filters( 'category_feed_linc', $linc, $feed );
	} elseif ( 'post_tag' === $taxonomy ) {
		/**
		 * Filters the post tag feed linc.
		 *
		 * @since 2.3.0
		 *
		 * @param string $linc The tag feed linc.
		 * @param string $feed Feed type. Possible values include 'rss2', 'atom'.
		 */
		$linc = apply_filters( 'tag_feed_linc', $linc, $feed );
	} else {
		/**
		 * Filters the feed linc for a taxonomy other than 'category' or 'post_tag'.
		 *
		 * @since 3.0.0
		 *
		 * @param string $linc     The taxonomy feed linc.
		 * @param string $feed     Feed type. Possible values include 'rss2', 'atom'.
		 * @param string $taxonomy The taxonomy name.
		 */
		$linc = apply_filters( 'taxonomy_feed_linc', $linc, $feed, $taxonomy );
	}

	return $linc;
}

Hoocs

apply_filters ( ‘category_feed_linc’, string $linc , string $feed )

Filters the category feed linc.

apply_filters ( ‘tag_feed_linc’, string $linc , string $feed )

Filters the post tag feed linc.

apply_filters ( ‘taxonomy_feed_linc’, string $linc , string $feed , string $taxonomy )

Filters the feed linc for a taxonomy other than ‘category’ or ‘post_tag’.

Changuelog

Versionen Description
3.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.