Changeset 44537 for trunk/src/wp-admin/includes/deprecated.php
- Timestamp:
- 01/10/2019 02:36:40 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/deprecated.php
r42737 r44537 1515 1515 <?php 1516 1516 } 1517 1518 /**1519 * Ajax handler for tag search.1520 *1521 * @since 3.1.01522 * @deprecated 5.0.0 Use the REST API tags endpoint instead.1523 */1524 function wp_ajax_ajax_tag_search() {1525 _deprecated_function( __FUNCTION__, '5.0.0', '/wp-json/wp/v2/tags' );1526 1527 if ( ! isset( $_GET['tax'] ) ) {1528 wp_die( 0 );1529 }1530 1531 $taxonomy = sanitize_key( $_GET['tax'] );1532 $tax = get_taxonomy( $taxonomy );1533 if ( ! $tax ) {1534 wp_die( 0 );1535 }1536 1537 if ( ! current_user_can( $tax->cap->assign_terms ) ) {1538 wp_die( -1 );1539 }1540 1541 $s = wp_unslash( $_GET['q'] );1542 1543 $comma = _x( ',', 'tag delimiter' );1544 if ( ',' !== $comma ) {1545 $s = str_replace( $comma, ',', $s );1546 }1547 if ( false !== strpos( $s, ',' ) ) {1548 $s = explode( ',', $s );1549 $s = $s[ count( $s ) - 1 ];1550 }1551 $s = trim( $s );1552 1553 /** This filter is documented in wp-includes/script-loader.php */1554 $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s );1555 1556 /*1557 * Require $term_search_min_chars chars for matching (default: 2)1558 * ensure it's a non-negative, non-zero integer.1559 */1560 if ( ( $term_search_min_chars == 0 ) || ( strlen( $s ) < $term_search_min_chars ) ) {1561 wp_die();1562 }1563 1564 $results = get_terms(1565 $taxonomy, array(1566 'name__like' => $s,1567 'fields' => 'names',1568 'hide_empty' => false,1569 )1570 );1571 1572 echo join( $results, "\n" );1573 wp_die();1574 }
Note: See TracChangeset
for help on using the changeset viewer.