Issues with categories grouping / filtering

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Issues with categories grouping / filtering

This topic contains 8 replies, has 2 voices, and was last updated by

5 years, 8 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #8657



    We have a media press website in french.
    We are producing several types of content organized in :
    – news (first level category)
    – different written articles (2nd level categories Under “article” 1st level parent category)
    – different videos which are using similar system as above (assigned to 2nd level category Under a 1st level parent category “video”)
    – And then 3 types of custom posts (ludopeople / tests / jeux) that are each assigned their own category

    We have 1 issue at the moment trying to validate AJAX search pro as our new engine :

    – We’d like the users to be able to filter their searches using the parent categories.
    I made some testing around this and found out that it’s not working. When selecting video parent category for instance, I don’t get any of the contents from “ludochrono” category which is a child of “video”.
    What is the most strange is that I only changed the frontend search settings > categories and excluded the child categories only for the visibility of the settings tab available for the user while Advanced options > exclude results is empty not listing any category on the right side.

    Could you please help on this ?
    I found some discussions on support forums where it looked like it should be working fine and some user got this sorted in v3.1 of the plugin.
    But we’re using 4.8.4 on our website.

    I’m attaching all screenshots related to WordPress config and AJAX search pro.
    And provided an admin account to connect.

    Thanks in advance.

    You must be logged in to view attached files.


    Thank you for the detailed description of the problem, it helps me a lot. I’m not sure what exactly the problem is, but your configuration appears to be correct to me.

    Can you please check the log-in credentials? I was trying to log in, but it does not let me access the back-end nor the front-end of the website.

    There is one thing you should probably try:
    – On the Frontend Search Settings -> Advanced panel, try changing the Category/Taxonomy terms logic option to At least one of the selected terms should match value:

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    You cannot access this content.


    I’m still getting the same error message after login:

    The URL seems to be correct, the on the address bar. Am I doing something incorrectly?

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    You cannot access this content.

    Thank you, it’s working now.

    I have found a few possible causes:

    1. Items within the “Ludochrono” category are actually not part of the “Videos” category, regardless if it’s a sub category. The items there are not marked with the “Videos” category. Therefore if the “match at least one of the categories” logic is chosen, it won’t match anything from “ludochrono” because none of the items there is actually part of “Videos” within the database.

    2. If I change the “Category/Taxonomy terms logic” option to “All of the selected terms should match”, the items from “Ludochrono” will start to appear in the results – because the “Ludochrono” category is not excluded anywhere, and they will show up, no matter if the “Videos” is unticked, because they are not categorized there.

    3. The groups are not affected by the category filters selected. I see you have the “Article”, “Jeux” … parent categories selected to be displayed. Even if the items are correctly categorized, they might not appear only within those selected parent category groups only in the result list. So items from “Ludochrono” might appear within the “Ludochrono” group, instead of “Videos” group. (or both if selected).

    A huge group-related rework is coming soon (within 2 updates), which will give you better ability to choose grouping orders, categories, terms, tags, post types and other stuff for better control and configuration. I’m working on this plugin every day, as fast as possible 🙂

    Until then, this might be a bit buggy, or might not produce the exactly expected output, my apologies for that – it’s a very old part of the plugin.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)




    thanks for the answer.
    Please find my comments below :

    1. I do understand items are not marked with the parent category and this is intended as this is the principle of parent-child system I’m using. I can see in category management (wordpress admin) that Ludochrono is under vide.
    if I just mark all the categories in the search pro plugin config and request to have hierarchy respected I can see video then all the sub-categories in the form. I can try a workaround assigning my items to both video and the appropriate sub-category but that would cause quite a mess with the rest of my WP dev which is already managing properly sub-categories.

    2. I do understand the logic of this. I thought that it would have been a more restrictive setting to set it that way. However there are 2 things that are still wierd : I don’t have the behaviour you’re describing about ticking the video category, it does remove the ludochronos from the list and the other one is that unticking “jeux” or “article” removes all articles / videos that are in child categories (news is still there as this is a single category not inside a hierarchy). Jeux is a separate category only used for custom posts and article should not have any relationship with the videos…

    3. This is what I was expecting, I’m happy seeing the different sub-categories in the grouping such as ludochronos rather than video. This is again something that is preventing me to do some “double category assignation” as I’m not sure if I would get the parent or the child in the grouping if items are assigned 2 categories.

    Actually it’s quite better right now as I get the content of the subs displayed but the last real issue left is the fact I can’t rely on the filters available for the end-users. Unticking some of them seems to remove content unrelated.

    You can check the behavior I’m experiencing in the home page while searching for the term “Kingsburg”.
    Which is generating content in jeux / news / just played (sub of article) / tests / chronique (sub of article) / ludopeople / ludochrono (sub of video).
    All the subs disappear as soon as I untick any option in category filter.


    • This reply was modified 5 years, 8 months ago by  shahindoh.


    Hi do you have a workaround for the remaining issue mentionned above ?

    Just to know if I should expect some update / fix for that or if I plan to remove the selector to move the plugin to prod (which will have impact as I will have to unbind my dev site and then enable the licence on the prod).





    Sorry for the late response, I got a bad fever yesterday, could only answer a few simpler threads.

    1. I’m not sure if there will be a fix available to automatically parse parent categories for filtering. I see two reasons:
    a. Performance. This additional selection would make an incredible performance setback. As opposed to the scenario where the term is simply related to the post object, additional queries are reqired to resolve the parent-child category connections. For each child element per post it means an additional query – growing expontentially.
    b. Currently it allows for a child category object not to be related to it’s parent (or in other words not directly related). It can be clearly indicated in the post editor by ticking/unticking the parent category. It’s represented in the database as well. When the parent category is not selected, there is no database record showing the relation between the post and the parent category itself.

    I will definitely look into this in more detail, but I’m not sure if it’s doable without creating a huge performance issue.

    2. and 3. – You are right. This seems to be an issue with the current release I didn’t know yet. If I unticked anything, then only posts from the ticked categories appear, which is not what is supposed to happen when the “AND” logic is selected.
    I even made a second, test search form to confirm it’s not something with the configuration, and it’s not.

    I don’t see FTP access to your server, but I could replicate the issue on my test environments and possibly found a solution. I will have to run a lot more tests to confirm, but it appears to be working. If you want to fix it manually, then you need to change the following:

    Open up the wp-content\plugins\ajax-search-pro\includes\classes\search\search_content.class.php file on your server and scroll to line 651, which should be this:

    $include_cats = count($options[‘categoryset’]) == count($_needed_cat) ? array() : $options[‘categoryset’];

    change that line simply to:

    $include_cats = array();

    Basically, after processing the ticked/unticked/excluded terms, this code part is simplified down to 2 arrays. One is for the terms to exclude, the second is for the ones to include. The first code line above looks like a mistake to me, as it forces to include only elements from the ticked items, which incorrect.

    If you want me to help finding/changing this code, feel free to post temporary FTP access and I will do it for you. I hope this helps.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.