Advertisement
wclovers

Untitled

Jul 27th, 2023
798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. // Sort Store taxonomy in alphabetical order
  2. add_filter( 'wcfm_vendor_store_taxomonies', function( $taxonomies, $vendor_id, $taxonomy ) {
  3.     $terms = [];
  4.     foreach( $taxonomies as $term_id => $termArray ) {
  5.         $term = get_term( absint( $term_id ), $taxonomy );
  6.         $terms[$term_id] = isset( $term->name ) ? $term->name : '';
  7.     }
  8.     asort($terms);
  9.  
  10.     foreach( $terms as $term_id => $term ) {
  11.         $terms[$term_id] = $taxonomies[$term_id];
  12.     }
  13.  
  14.     return $terms;
  15. }, 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement