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
1370      /**
1371       * Filter the ORDERBY clause of the terms query.
1372       *
1373       * @since 2.8.0
1374       *
1375       * @param string       $orderby    ORDERBY clause of the terms query.
1376       * @param array        $args       An array of terms query arguments.
1377       * @param string|array $taxonomies A taxonomy or array of taxonomies.
1378       */
1379      $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies );
1380
1381      $order = strtoupper( $args['order'] );
1382      if ( ! empty( $orderby ) ) {
1383           $orderby = "ORDER BY $orderby";
1384      } else {
1385           $order = '';
1386      }
1387
1388      if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {