ap_update_qameta_terms( integer $question_id )
Description #
Updates terms of qameta.
Parameters #
- $question_idinteger (Required) Question ID.
Source #
File: includes/qameta.php
function ap_update_qameta_terms( $question_id ) {
$terms = array();
if ( taxonomy_exists( 'question_category' ) ) {
$categories = get_the_terms( $question_id, 'question_category' );
if ( $categories ) {
$terms = $terms + $categories;
}
}
if ( taxonomy_exists( 'question_tag' ) ) {
$tags = get_the_terms( $question_id, 'question_tag' );
if ( $tags ) {
$terms = $terms + $tags;
}
}
if ( taxonomy_exists( 'question_label' ) ) {
$labels = get_the_terms( $question_id, 'question_label' );
if ( $labels ) {
$terms = $terms + $labels;
}
}
$term_ids = array();
foreach ( (array) $terms as $term ) {
$term_ids[] = $term->term_id;
}
if ( ! empty( $term_ids ) ) {
ap_insert_qameta( $question_id, array( 'terms' => $term_ids ) );
}
return $term_ids;
}
Expand full source code Collapse full source code View on GitHub: includes/qameta.php:462
Add your comment