AnsPress_Tag::ap_tags_suggestion()
Description #
Handle tags suggestion on question form
Source #
File: addons/free/tag.php
public static function ap_tags_suggestion() { $keyword = ap_sanitize_unslash( 'q', 'r' ); $tags = get_terms( 'question_tag', array( '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/free/tag.php:442
Add your comment