I am working with hidden link to make their filters compatible with the Toolset view.
They wanted me to ask you:
We need to modify the argument of get_posts() function used in the blocks of Toolset View block because we need to pass argument 'supress_filters' => false .
Do you have any developer hook we can use for that?
Their developer tried to add a post_where filter but is not affecting that section.
Their plugin basically we use the wordpress post_where filter to remove posts that shouldn't show.
post_where filter it's executed in WpQuery, but that section in our home page is not filtering for some reason.
Can I provide you access to where you can take a look?
For example, suppose you have a view with ID "12345" and you'd like to exclude the posts with IDs "67" and "89" from the view's output. The filtering function would look like this:
add_filter( 'wpv_filter_query', 'wpv_filter_query_func', 1000 , 3 );
function wpv_filter_query_func( $query_args, $view_settings ) {
// process if specific view
if ( !is_admin() && ( isset($view_settings['view_id']) && $view_settings['view_id'] == 12345) ) {
$query_args['post__not_in'] = array(67, 89);
}
return $query_args;
}
Using this example, you or your developer can make the list of posts to exclude dynamically, using the criteria that you have in mind.
They commented out their fuction that return the posts that needs to be excluded and I simply hardcoded the post id number like this: $query_args['post__not_in'] = ['1864'];
add_filter( 'wpv_filter_query', 'wpv_filter_query_func', 1000 , 3 );
function wpv_filter_query_func( $query_args, $view_settings ) {
// process if specific view
if ( !is_admin() ) {
// $query_args['post__not_in'] = get_geotargeted_posts();
$query_args['post__not_in'] = ['1864'];
}
return $query_args;
}
and it's still didn't remove the post from the view. Can I provide you access so you can take a look?
Thank you for waiting, as I investigated this rather odd behaviour.
During troubleshooting, I noticed that some custom script is added in the view "All Resources For Home Page".
( screenshot: hidden link )
The custom function is working as expected to exclude the post with ID "1864", but after the page loading has completed, this custom script automatically triggers the search with a value in the hidden language field.
If you'll remove this custom script, you'll see that this post with ID "1864" will not be shown by the view.