I'd like to search posts by year. For example, I could type in "June 2015" and all posts from that time appear. Or, I could type "2015" and all posts from the year appear.

Currently, I have Relevanssi set to index all public posts and attachments, including all categories and tags. Yet, posts from a searched time (ex, "2015") are not populating, unless the term is in the title or post content.

I can't seem to find a solution anywhere. Hoping for some help!


I was able to receive the solution from the developer. Add the below code into functions.php and then rebuild the Relvanssi index. This worked for me.

function rlv_index_post_date( $content, $post ) {
    $date = get_the_time( "F Y", $post->ID );
    $content .= " $date";
    return $content;
add_filter( 'relevanssi_content_to_index', 'rlv_index_post_date', 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.