apply_filters( 'relevanssi_taxonomy_term_to_post', object $post )

This filter hook lets you modify post objects Relevanssi Premium creates from taxonomy terms.


(object) The post object from the taxonomy term.

More information

When Relevanssi Premium searches taxonomy terms, it needs to create posts, as search results templates want to see posts. This conversion happens in relevanssi_premium_get_post(), and you can use this filter hook to adjust the post object created in the process.

The objects are not WP_Post objects but look like them. The taxonomy term name is stored in $post->post_title$post->post_content has the term description. $post->relevanssi_link has the taxonomy term archive URL from get_term_link()$post->post_type is set to the taxonomy and the term ID is stored in $post->term_id ($post->ID is -1). The term parent is stored in $post->post_parent. The post status for users is “publish“, $post->post_date is set to the current time and $post->post_author is set to 0.

You can modify all these values with this filter hook.