or relationship not working
-
I created a filter set for my blog categories. When checking one category all relevent posts are shown. When checking two categories, only posts from the first category in the query-URL are shown. But I selected OR instead of AND in the filter set options.
What could be wrong with my settings?
-
Hi @tippl
Thank you for your interest in the Filter Everything plugin.
More likely you created multiple filter sets (even the one that’s in the trash) with different views, such as a dropdown or a radio button. So this is causing the conflict.
Best Regards – Victor
Unfortunatelly not. I have just one filter set and nothing in the trash.
Can you please send the link to the page with the issue so we can check it?
If this is not the case that we described previously, there can be at least, 10 other things including but not limited to the most common ones like theme, plugins, and custom code conflict, var names, slugs crossing, etc.
Best Regards – Victor
https://test.lechatinformatique.de/aktuelle-meldungen/
Two issues:
– Kategorie 1 which is the default category isn’t shown in the filter list
– if I check Kategorie 2 and 3, I get only all posts from 2.Theme is TT4, WP latest Version, only 2 Plugins are enabled. – yours and GenerateBlocks.
- This reply was modified 2 months, 3 weeks ago by Manja Neumann.
Hi @tippl
Try to change categories slugs to category_1, category_2, and category_3 or category1, instead of category-1, save them all, go to the filter set, hit update, and then test the filter workability.
As to the default categories, we’d not recommend using them. But if you want to add them to the filter terms there are two hooks: (We send it together with the functions) so you can change the function to the needed logic of yours:
add_filter('wpc_filter_term_query_args', 'flrt_exclude_uncategorized_category', 10, 3);
if( ! function_exists('flrt_exclude_uncategorized_category') ) {
function flrt_exclude_uncategorized_category($args, $entity, $e_name)
{
if ($e_name === 'category') {
$args['exclude'] = array(1); // Uncategorized category
}
return $args;
}
}For Woo Products
add_filter( 'wpc_filter_get_taxonomy_terms', 'flrt_exclude_product_visibility_terms', 10, 2 );
if( ! function_exists('flrt_exclude_product_visibility_terms') ) {
function flrt_exclude_product_visibility_terms( $terms, $e_name )
{
if( $e_name === 'product_visibility' ){
if( is_array( $terms ) ){
foreach ( $terms as $index => $term ){
if( in_array( $term->slug, array( 'exclude-from-search', 'exclude-from-catalog' ) ) ){
unset( $terms[$index] );
}
}
}
}
if( $e_name === 'product_cat' ){
if( is_array( $terms ) ){
foreach ( $terms as $index => $term ){
if( in_array( $term->slug, array( 'uncategorized' ) ) ){
unset( $terms[$index] );
}
}
}
}
return $terms;
}
}Best Regards – Victor
Thanks for your suggestions. I incuded the default filter and still can’t see it.
I changed the categories to dogs, cats and crocodiles. Something far from possible slug issues and updated the filter set. Nothing changed. Only the first of two categories is shown.
- This reply was modified 2 months, 3 weeks ago by Manja Neumann.
In this case, it should be some conflict with other plugins, or themes. (So you might want to turn off plugins and change the theme to the default)
Also, we had a situation where the cause of the problem was that the server was configured to consider the character ’;’ parameter as a separator in Query String.
Normally, the separator is always the ‘&’ sign. But your server is more likely configured in such a way that parameter separators are both the ‘&’ sign and the ’;’ character.
Here is what you can do, add to your wp-config.php file the next code:
define('FLRT_QUERY_TERMS_SEPARATOR', ':' );
It will change the separator in the plugin from ; to the : and check if everything will start working correctly.
It is quite hard to get to the issue right away, as we basically guessing what could it be. Usually, we set a default WP theme like 2021, turning off almost all plugins, and leaving our plugin and WooCommerce if it is used for Woo products. Then we go to the filter set, hit update, and after that, we go to the filtered page with the issue and refresh it, then check if it is working. If still not working then the issue is deeper and connected to the server settings.
Best Regards – Victor
Theme: TwentyTwentyFour
Plugins: only GenerateBlocks and yours
I changed the wp-config. The parameters inside the url changed too, refreshed the filter set and the filter page, but nothing. It do not work on test server and local. Both have different settings. It is really frustrating, because it should only show all categories and all filtered posts.
Hi @tippl
We recreated it fully on our Local Server, with the 2024 default WP theme with FE and GenerateBlocks plugins only.
You can check it here – https://prnt.sc/mAYX3JGFpj8b
And this is the results – https://prnt.sc/ug-RIBYE8B54
Posts are displayed via the query loop that this GenerateBlocks plugin provides (which is not the best option considering the pagination), but still, everything is working as it should (we are testing it on the category page).
The default (uncategorized) categories are not displayed in the filter terms, but in order to display them you can modify the function to show them with the hooks that we provided earlier.
Based on this, we are not exactly sure why it is not working on your site, it should be connected somehow to the server settings or site settings already as this is a unique issue on your site only.
Best Regards – Victor
Thank you very much for your efforts. I swapped the GeneratePress query loop for the WP loop as a test and now the or selection works. So there seems to be an inconsistency between these two.
- You must be logged in to reply to this topic.