• Resolved dizajner

    (@dizajner)


    Hello,

    I’m trying to sort my terms by term order (like menu order), but nothing changes. I get the impression that sorting order by doesn’t work, because nothing happens regardless of the option I select.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author WP Smart Widgets

    (@nomade123456)

    Hi @dizajner,

    If sorting by term order doesn’t seem to have any effect, make sure the taxonomy you’re using has ‘sort’ => true enabled when it’s registered. For example, in ACF, you can enable this under Advanced Settings > General > “Sort Terms”. Without that, WordPress may ignore the term order in the filter’s query.

    Also, keep in mind that some sorting options might appear to do nothing if your terms already match the selected order. For instance, when sorting by post count, if all terms have the same count, the order won’t visibly change.

    Let me know if this helped.

    Regards,
    Dara

    Thread Starter dizajner

    (@dizajner)

    Hi,

    I just activated it; it wasn’t activated before. I can now move my order, but there is no effect on ASC or DESC.

    If I want to put it in the order I want, I have to put the first one last, and so on.

    Plugin Author WP Smart Widgets

    (@nomade123456)

    Hi @dizajner,

    BPFWE uses the native get_terms() function to fetch and sort terms, so the sorting behavior (including ASC/DESC) relies entirely on how WordPress handles the taxonomy.

    If ASC/DESC has no effect, it’s typically due to one of the following:

    1. The way the taxonomy is registered (e.g., missing 'sort' => true)
    2. Another plugin modifying the query (any plugins used to reorder taxonomy terms)
    3. A custom function hooking into the term query

    BPFWE doesn’t force any specific order, it simply passes the selected settings to get_terms(). If something else modifies the behavior after that, it’s outside the plugin’s control.

    If you can’t find what’s overriding the sorting, a simple workaround would be to re-order the terms using js on the front-end.

    Thread Starter dizajner

    (@dizajner)

    I found the reason why it doesn’t work. I use Colorlib’s Simple Custom Post Order plugin to order my posts and terms. They say that custom ordering only works if you don’t use sorting or sort by.

    In your plugin, I don’t have the option to disable sorting by. I only have ‘name’, ‘slug’, ‘count‘, ‘term group’, ‘term order’, and ‘term id’.

    I need to be able to select ‘none’ for ‘sort by’ so that my custom order is taken into effect, as if it were the get_terms query without sort by parameters.

    Can you add this option ?

    Plugin Author WP Smart Widgets

    (@nomade123456)

    Hi @dizajner,

    Glad to hear you figured out what was causing the issue with the term order. Thanks for the suggestion, I’ll definitely consider adding a “Select None” option in a future release.

    In the meantime, since this option isn’t currently available, the only way to default to “none” would be to comment out a few lines in class-bpfwe-filter-widget.php: 3091, 3195, 3285, 3453, 3543, and 3719.

    Hope that helps! I’ll mark this as resolved for now, but feel free to open a new thread if anything else comes up.

    Regards,
    Dara

    Plugin Author WP Smart Widgets

    (@nomade123456)

    Hi @dizajner,

    Just wanted to let you know that the “None” option for sorting is now available in the latest version of the plugin (1.5.3). Let me know if things are working out as you wanted.

    Thanks for the feedback!

    Dara

    Thread Starter dizajner

    (@dizajner)

    Hi,

    Thank you for the update. However, it has not resolved my ordering issue, i.e. in my child terms, the display returns the reverse order of $lowterms.

    I have found the issue.

    In the code, you do an array_pop( $terms_stack ), then an array_reverse( $child_terms ).

    In a correct use case, you would need to do an array_shift($terms_stack), then an array_reverse( $child_terms ). -> Line 3226 of class-bpfwe-filter-widget.php

    Or, if that is not the cause of the ordering problem, you need to find a solution so that the order returned to the front end is the same as the order in $lowterms.

    Furthermore, to summarise, the order displayed is not the same as that of get_terms with the $args provided.

    Can you look into correcting this? I have overwritten this function in the code directly on my end to make it work.

    Thanks

    Plugin Author WP Smart Widgets

    (@nomade123456)

    Hi @dizajner,

    The current behavior is intentional, child terms are reversed by design to produce a consistent hierarchical display. Not everyone uses custom functions or plugins to order their taxonomies, so without reversing, the children would appear in reverse order compared to the default $lowterms hierarchy.

    For the next release, I’ll extend the logic so that the reversal is conditional on the orderby setting, giving you more control over the output. I would also recommend updating to the latest release of the plugin, if it isn’t already the case.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Order by term order issue’ is closed to new replies.