<?php
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'has_image' == $params['facet_name'] ) {
$post_id = (int) $params['post_id'];
if ( has_post_thumbnail( $post_id ) ) {
$params['facet_value'] = 1;
$params['facet_display_value'] = 'Has photos';
}
else {
$params['facet_value'] = ''; // skip indexing this row
}
}
return $params;
}, 10, 2 );