How to filter WP attachments

By default, FacetWP only indexes published items, which excludes attachments.

Indexing attachments

To index attachments (media items) too, use this hook and re-index afterwards:

add_filter( 'facetwp_indexer_query_args', function( $args ) {
    $args['post_status'] = [ 'publish', 'inherit' ];
    return $args;

Displaying attachments

Attachments are post types that have post_status = inherit, meaning that they’re not technically published and won’t display by default. To show them, you’ll need to manually set the post status. If using the Layout Builder, you can do this within the Query┬átab: