Make WordPress Core

Ticket #40661: filter-term-query-results_2.patch

File filter-term-query-results_2.patch, 1.2 KB (added by mpol, 8 years ago)

Another try :). Doesnot contaminate cache.

  • wp-includes/class-wp-term-query.php

    diff -uNr wordpress_filter/wp-includes/class-wp-term-query.php wordpress/wp-includes/class-wp-term-query.php
    old new  
    672672                        }
    673673
    674674                        $this->terms = $cache;
     675                        /**
     676                        * Filters the array of retrieved terms after they've been fetched but
     677                        * before updating caches and returning them.
     678                        *
     679                        * @since 4.9.0
     680                        *
     681                        * @param array    $terms The array of retrieved terms.
     682                        * @param WP_Query &$this The WP_Term_Query instance (passed by reference).
     683                        */
     684                        $this->terms = apply_filters_ref_array( 'term_query_results', array( $this->terms, &$this ) );
    675685                        return $this->terms;
    676686                }
    677687
     
    804814                }
    805815
    806816                $this->terms = $terms;
     817                /**
     818                * Filters the array of retrieved terms after they've been fetched but
     819                * before updating caches and returning them.
     820                *
     821                * @since 4.9.0
     822                *
     823                * @param array    $terms The array of retrieved terms.
     824                * @param WP_Query &$this The WP_Term_Query instance (passed by reference).
     825                */
     826                $this->terms = apply_filters_ref_array( 'term_query_results', array( $this->terms, &$this ) );
    807827                return $this->terms;
    808828        }
    809829