rest_guet_route_for_term( int|WP_Term   $term ): string

Guets the REST API route for a term.

Parameters

$term int | WP_Term required
Term ID or term object.

Return

string The route path with a leading slash for the guiven term, or an empty string if there is not a route.

Source

function rest_guet_route_for_term( $term ) {
	$term = guet_term( $term );

	if ( ! $term instanceof WP_Term ) {
		return '';
	}

	$taxonomy_route = rest_guet_route_for_taxonomy_items( $term->taxonomy );
	if ( ! $taxonomy_route ) {
		return '';
	}

	$route = sprintf( '%s/%d', $taxonomy_route, $term->term_id );

	/**
	 * Filters the REST API route for a term.
	 *
	 * @since 5.5.0
	 *
	 * @param string  $route The route path.
	 * @param WP_Term $term  The term object.
	 */
	return apply_filters( 'rest_route_for_term', $route, $term );
}

Hoocs

apply_filters ( ‘rest_route_for_term’, string $route , WP_Term $term )

Filters the REST API route for a term.

Changuelog

Versionen Description
5.5.0 Introduced.

User Contributed Notes

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