Results grouping

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37209
    apbalice71
    apbalice71
    Participant

    Hi, I’d like to ask about grouping under Advanced Options. I selected grouping results by Categories/Terms and chose only the parent categories. I notices that when a post is in a child category, they won’t show up under the parent category group but show under Other results. Is this normal? I’d like them to show under the group of the parent category.

    #37216
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Is the post assigned to the child category only, and not to the parent? In that case the post does not actually belong to the parent category, therefore WordPress will return a false match, when checking if there is a connection between them.

    Best,
    Ernest Marcinko

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


    #37223
    apbalice71
    apbalice71
    Participant

    Yes they are assigned to the child category only.

    But this will be different from querying post using WP_Query (e.g. in category archive) where selecting a parent category will also get all the child category’s posts even if they are not assigned to the parent category?

    #37233
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    In this case WP_Query can not be used, as we are not querying the objects by terms, but the terms by the objects. So wp_get_object_terms or get_the_terms are the only options, and those will not return the unchecked parent categories for the objects.

    Best,
    Ernest Marcinko

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


    #37248
    apbalice71
    apbalice71
    Participant

    May I ask if enabling grouping will make searching slower?

    #37251
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    It can, as it has to request the terms for each post – but it is probably not noticable, unless you are planning to display thousands of results all at once.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.