apply_filters( 'relevanssi_by_date_query_filter', string $query_restrictions, string $by_date )

This filter hook filters the by_date parameter MySQL.


(string) The MySQL query restrictions.

(string) A number followed by a unit letter (for example 24h, 7d).

More information

When Relevanssi processes query variables, it converts them to MySQL query restrictions. This filter hook lets you modify the MySQL query for by_date parameters.

These parameters become “ AND relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts WHERE posts.post_date > DATE_SUB(NOW(), INTERVAL $n $unit))” where $n is the number and $unit is the unit.