X Features Cars Demo Power Plants Demo State Parks Demo Site Showcase Docs Tutorials Add-ons Buy

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

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 );

See Also

Template Configuration

facetwp_query_args

facetwp_filtered_post_ids