facetwp index date as raw value for sorting

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

add_filter( ‘facetwp_index_row’, function ( $params, $class ) {
if ( ‘my_facet’ == $params[‘facet_name’] ) { // change ‘my_facet’ to the name of your facet
$params[‘facet_value’] = get_the_date( ‘Ymd’, $params[‘post_id’] );
}
return $params;
}, 10, 2 );
{{/gist}}