Hi martiniboy,
I’m writing to update you about the issue you reported.
We could finally understand what is causing the conflict between Product Filter and Ultimate Members.
I’ll immediately tell you that the problem lies in the Ultimate Member plugin, because it runs some operations in a way which is not properly correct.
Anyway, I’ll briefly explain you the issue in case you wanted to get in touch with the plugin developer:
At line 11 in the file htdocs/wp-content/plugins/ultimate-member/core/um-builtin.php the plugin performs the following action:
add_action(‘init’, array(&$this, ‘set_predefined_fields’), 1);
The set_predefined_fields method recalls, in turn, the get_roles method of the class UM_Querey. All this can be found in htdocs/wp-content/plugins/ultimate-member/core/um-query.php. The get_roles method runs a WP_Query (line 395) and it’s exactly this operation that makes the shop query mess up any time there’s an active filter (from the tests made, we see that attributes filters are not working, while category and tag filters work perfectly).
To be honest, I don’t understand the reason for this choice. Performing such an action and assigning a priority 1 to it is quite risky. The only thing that I can do is to change the query priority of Ultimate Members to 2. This way, Product Filter and the shop start working fine and regularly as usual, but the plugin Ultimate Members needs to be tested carefully to understand if the change I applied causes any issues. You should make this test and replicate a real case of how the Ultimate Members is used, which I would hardly manage to do on my own on my local environment.
Copy and paste this code:
if( class_exists( ‘UM_API’ ) ){
add_action( ‘init’, ‘yith_ultimate_member_support_for_product_filter’, 0 );
function yith_ultimate_member_support_for_product_filter(){
global $ultimatemember;
if( $ultimatemember ){
remove_action(‘init’, array($ultimatemember->builtin, ‘set_predefined_fields’), 1);
add_action(‘init’, array($ultimatemember->builtin, ‘set_predefined_fields’), 2);
}
}
}
into the functions.php file placed in the main root of your website (at the bottom of the file) and make a test. I hope everything will work fine. If it doesn’t, I’m really sorry, but I won’t be able to help you futher because the problem is not caused by my plugin. I only ask you a favour: please, could you keep me updated about the test? Because if this hack works, I can add it as compatibility fix into my Product Filter plugin, because, as you can already image, you’re not the only one who’s experiencing this issues.
Thanks for your patience and… let’s keep our fingers crossed!
Best regards