Tags::ap_tags_suggestion()
Description #
Handle tags suggestion on question form
Source #
File: addons/tags/tags.php
public function ap_tags_suggestion() { $keyword = ap_sanitize_unslash( 'q', 'r' ); $tags = get_terms( array( 'taxonomy' => 'question_tag', 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => false, 'search' => $keyword, 'number' => 8, ) ); if ( $tags ) { $items = array(); foreach ( $tags as $k => $t ) { $items [ $k ] = $t->slug; } $result = array( 'status' => true, 'items' => $items, ); wp_send_json( $result ); } wp_send_json( array( 'status' => false ) ); }
Expand full source code Collapse full source code View on GitHub: addons/tags/tags.php:502
Add your comment