lucasvitalmdgabriel

how to orderby get_terms for wordpress taxonomy

Nov 10th, 2017
605
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function pre_get_terms( $query ) {
  2.         $meta_query_args = array(
  3.             'relation' => 'AND', // Optional, defaults to "AND"
  4.             array(
  5.                 'key'     => 'order_index',
  6.                 'value'   => 0,
  7.                 'compare' => '>='
  8.             )
  9.         );
  10.         $meta_query = new WP_Meta_Query( $meta_query_args );
  11.         $query->meta_query = $meta_query;
  12.         $query->orderby = 'position_clause';
  13.     }
RAW Paste Data