Title: Indexing post date
Last modified: September 1, 2016

---

# Indexing post date

 *  Resolved [bluehelmet](https://wordpress.org/support/users/bluehelmet/)
 * (@bluehelmet)
 * [10 years ago](https://wordpress.org/support/topic/indexing-post-date/)
 * 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’ve seen solutions for searching within date ranges, but that’s not what I’m
   going for. I just want the post_date indexed, along with my other taxonomies.
 * Any help is much appreciated!
 * [https://wordpress.org/plugins/relevanssi/](https://wordpress.org/plugins/relevanssi/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [10 years ago](https://wordpress.org/support/topic/indexing-post-date/#post-7695717)
 *     ```
       add_filter( 'relevanssi_content_to_index', 'rlv_index_post_date', 10, 2 );
       function rlv_index_post_date( $content, $post ) {
           $date = get_the_time( "F Y", $post->ID );
           $content .= " $date";
           return $content;
       }
       ```
   
 * Add this to your theme functions.php and rebuild the index, and it should work.
 *  Thread Starter [bluehelmet](https://wordpress.org/support/users/bluehelmet/)
 * (@bluehelmet)
 * [10 years ago](https://wordpress.org/support/topic/indexing-post-date/#post-7695812)
 * That’s exactly what I needed! Thank you!
 * I really appreciate that you take time to help everyone on this support forum.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Indexing post date’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)
 * [index](https://wordpress.org/support/topic-tag/index/)
 * [month](https://wordpress.org/support/topic-tag/month/)
 * [post_date](https://wordpress.org/support/topic-tag/post_date/)
 * [terms](https://wordpress.org/support/topic-tag/terms/)
 * [year](https://wordpress.org/support/topic-tag/year/)

 * 2 replies
 * 2 participants
 * Last reply from: [bluehelmet](https://wordpress.org/support/users/bluehelmet/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/indexing-post-date/#post-7695812)
 * Status: resolved