Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_terms_orderby

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1379      /**
1380       * Filter the ORDERBY clause of the terms query.
1381       *
1382       * @since 2.8.0
1383       *
1384       * @param string       $orderby    ORDERBY clause of the terms query.
1385       * @param array        $args       An array of terms query arguments.
1386       * @param string|array $taxonomies A taxonomy or array of taxonomies.
1387       */
1388      $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies );
1389
1390      if ( !empty($orderby) )
1391           $orderby = "ORDER BY $orderby";
1392      else
1393           $order = '';
1394
1395      $order = strtoupper( $order );
1396      if ( '' !== $order && !in_array( $order, array( 'ASC', 'DESC' ) ) )
1397           $order = 'ASC';