facetwp_pre_filtered_post_ids

Overview

Choose the initial bucket of post IDs, before any filtering is applied.

This is especially useful due to the WP limitation preventing post__in and post__not_in from being used simultaneously.

Parameters

    • $post_ids | array | An array of post IDs
    • $class | object | The FacetWP_Renderer class (see /includes/class-renderer.php)

Usage

Prevent post ID = 42 from appearing in results.

add_filter( 'facetwp_pre_filtered_post_ids', function( $post_ids, $class ) {
    if ( false !== ( $key = array_search( 42, $post_ids ) ) ) {
        unset( $post_ids[ $key ] );
    }
    return $post_ids;
}, 10, 2 );

More examples

See Also

facetwp_filtered_post_ids