Title: Sorting select lists?
Last modified: April 16, 2024

---

# Sorting select lists?

 *  Resolved [Keith](https://wordpress.org/support/users/sononaco/)
 * (@sononaco)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/sorting-select-lists/)
 * Is it possible to sort select lists? I have tried hacking the get_categories()
   call when loading $terms by adding “orderby” => “name” and “order” => “ASC” but
   it doesn’t seem to work. The only workaround I have found is to create a function
   and run the $terms through it before they are displayed:
 *     ```wp-block-code
       function w2dc_wmd_order_terms( $terms )
       {
               $terms_order = [];
               foreach( $terms as $t )
               {
                $terms_order[ $t->slug ] = $t;
               }
               ksort( $terms_order );
               $terms = [];
               foreach( $terms_order as $term => $t )
               {
                 $terms[] = $t;
               }
               return $terms;
       }
       ```
   
 * Of course this will get overwritten each time the plugin is updated. Can you 
   please add a hook or filter to those terms before they are displayed?
 * Thank you!

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shamalli](https://wordpress.org/support/users/mihail-chepovskiy/)
 * (@mihail-chepovskiy)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/sorting-select-lists/#post-17692796)
 * What exact “select lists” do you mean? There are multiple types of categories
   display in the plugin: at the backend, at the frontend, on submission form, search
   filters lists.

Viewing 1 replies (of 1 total)

The topic ‘Sorting select lists?’ is closed to new replies.

 * ![](https://ps.w.org/web-directory-free/assets/icon-256x256.gif?rev=3281630)
 * [Web Directory Free](https://wordpress.org/plugins/web-directory-free/)
 * [Support Threads](https://wordpress.org/support/plugin/web-directory-free/)
 * [Active Topics](https://wordpress.org/support/plugin/web-directory-free/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/web-directory-free/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/web-directory-free/reviews/)

## Tags

 * [add_filter](https://wordpress.org/support/topic-tag/add_filter/)
 * [enhancements](https://wordpress.org/support/topic-tag/enhancements/)
 * [terms](https://wordpress.org/support/topic-tag/terms/)

 * 2 replies
 * 2 participants
 * Last reply from: [Shamalli](https://wordpress.org/support/users/mihail-chepovskiy/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/sorting-select-lists/#post-17692796)
 * Status: resolved