Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created February 10, 2017 17:14
Show Gist options
  • Save mgibbs189/bb92f8219608e47b5562a83503223d0e to your computer and use it in GitHub Desktop.
Save mgibbs189/bb92f8219608e47b5562a83503223d0e to your computer and use it in GitHub Desktop.
FacetWP - WooCommerce Memberships fix
<?php
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
if ( 'wc_user_membership' == $query->get( 'post_type' ) ) {
$is_main_query = false;
}
return $is_main_query;
}, 10, 2 );
@clickstudio
Copy link

This just made my day. I have spent days trying to resolve an issue and this fixed it.

Will there be a permanent fix added to FacetWP ?

@wplaunchify
Copy link

fantastic!!! Saved my bacon today as well.... I lost all the rest of my hair before finding this....please put it in the plugin ;-)

@lkraav
Copy link

lkraav commented Sep 11, 2019

@mgibbs189 curious, do you happen to have any medicine for facet counts not respecting membership access rules?

image

Filters show numbers, but in reality the user can't see or list any of the items. How do we fix the counts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment