Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: terms_pre_query

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
692            *
693            * Return a non-null value to bypass WordPress's default term queries.
694            *
695            * @since 5.3.0
696            *
697            * @param array|null    $terms Return an array of term data to short-circuit WP's term query,
698            *                             or null to allow WP queries to run normally.
699            * @param WP_Term_Query $this  The WP_Term_Query instance, passed by reference.
700            */
701           $this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) );
702
703           if ( null !== $this->terms ) {
704                return $this->terms;
705           }
706
707           // $args can be anything. Only use the args defined in defaults to compute the key.
708           $key          = md5( serialize( wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ) ) . serialize( $taxonomies ) . $this->request );
709           $last_changed = wp_cache_get_last_changed( 'terms' );
710           $cache_key    = "get_terms:$key:$last_changed";