| @@ -1,0 +1,27 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Functions | |
| 4 | + * | |
| 5 | + * @package GamiPress\LearnDash\Functions | |
| 6 | + * @since 1.0.0 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +// Exit if accessed directly | |
| 10 | +if( !defined( 'ABSPATH' ) ) exit; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Retrieves post term ids for a taxonomy. | |
| 14 | + * | |
| 15 | + * @since 1.0.6 | |
| 16 | + * | |
| 17 | + * @param int $post_id Post ID. | |
| 18 | + * | |
| 19 | + * @return array | |
| 20 | + */ | |
| 21 | +function gamipress_tutor_get_term_ids( $course_id ) { | |
| 22 | + | |
| 23 | + $terms = get_the_terms( $course_id, 'course-category' ); | |
| 24 | + | |
| 25 | + return ( empty( $terms ) || is_wp_error( $terms ) ) ? array() : wp_list_pluck( $terms, 'term_id' ); | |
| 26 | + | |
| 27 | +} | |