-
Search Results
-
Hi,
We have set-up a custom query with an ACF relationship field.
This works without S&FP.
When we add
'search_filter_id' => 4356,
to the WP Query, suddenly all posts are shown and not only the ones we defined in our WP_Query. (when we comment it out, it works)Below the full code
// Get account linked to logged in user $account = get_field( 'field_5c3a01aa0a32e', 'user_' . get_current_user_id() ); // Get lassers from that account: returns array of ID's $lassers = get_field( 'field_5c3a0bb483f86', $account[0]->ID ); // args Query $args = array( 'post_type' => 'lasser', 'posts_per_page' => -1, 'post_status' => 'publish', 'order' => 'ASC', 'search_filter_id' => 4356, 'post__in' => $lassers, );
We also tried the filter sf_edit_query_args but that doesn’t work either.
Any idea why the above isn’t working/
I’m having problems filtering sf_edit_query_args with the post__in query arg. Here’s a quick prototype that I have:
add_filter( 'sf_edit_query_args', function( $query_args, $sfid ) { if ( 20205 === $sfid ) { $query_args['post__in'] = array( 20696, 20694, 20612 ); } return $query_args; }, 20, 2 );
I double-checked that 20205 is the id of the search&filter form and that 20696, 20694, 20612 are actual custom post type ids. The form works as it should with the usual search&filter search field, custom post type filters, tag dropdowns, etc. But I’m not able to filter it programmatically with the provided post ids (however, it works correctly with a provided custom post type –
$query_args['post_type'] = 'custom';
). It simply returns no results. Is the post__in query arg not supported?Thanks!
Take a look at this page. http://powerschoolnew.staging.wpengine.com/resources/?post_types=whitepaper
I have 7 sticky posts in this post type. You can find them in the HTML with class=”resource-block featured”. When I first load the URL above, only 3 of the sticky posts appear in the first set of results (I wrap them in a carousel using jQuery). As I scroll, the other sticky posts appear(they will be 50% wide. I then move them to the top with jQuery.
Why aren’t my sticky posts ALL appearing first before all non-sticky posts? I tried deliberately setting ignore_sticky_posts to false using sf_edit_query_args but this made no difference.
Thanks for any help you can offer.