Changeset 53781
- Timestamp:
- 07/26/2022 01:21:55 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r53747 r53781 162 162 ) 163 163 ); 164 165 /** 166 * Filters the Ajax term search results. 167 * 168 * @since 6.1.0 169 * 170 * @param string[] $results Array of term names. 171 * @param WP_Taxonomy $tax The taxonomy object. 172 * @param string $s The search term. 173 */ 174 $results = apply_filters( 'ajax_term_search_results', $results, $tax, $s ); 164 175 165 176 echo implode( "\n", $results ); -
trunk/tests/phpunit/tests/ajax/TagSearch.php
r53561 r53781 159 159 } 160 160 161 /** 162 * Test the ajax_term_search_results filter 163 * 164 * @ticket 55606 165 */ 166 public function test_ajax_term_search_results_filter() { 167 168 // Become an administrator. 169 $this->_setRole( 'administrator' ); 170 171 // Set up a default request. 172 $_GET['tax'] = 'post_tag'; 173 $_GET['q'] = 'chat'; 174 175 // Add the ajax_term_search_results filter. 176 add_filter( 177 'ajax_term_search_results', 178 static function( $results, $tax, $s ) { 179 return array( 'ajax_term_search_results was applied' ); 180 }, 181 10, 182 3 183 ); 184 185 // Make the request. 186 try { 187 $this->_handleAjax( 'ajax-tag-search', $_GET['tax'], $_GET['q'] ); 188 } catch ( WPAjaxDieContinueException $e ) { 189 unset( $e ); 190 } 191 192 // Ensure we found the right match. 193 $this->assertSame( 'ajax_term_search_results was applied', $this->_last_response ); 194 } 161 195 }
Note: See TracChangeset
for help on using the changeset viewer.