| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions |
| 4 |
* |
| 5 |
* @package GamiPress\WP_Job_Manager\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 |
* Taken from WooCommerce wc_get_product_term_ids() function |
| 16 |
* |
| 17 |
* @since 1.0.0 |
| 18 |
* |
| 19 |
* @param int $post_id Post ID. |
| 20 |
* @param string $taxonomy Taxonomy slug. |
| 21 |
* |
| 22 |
* @return array |
| 23 |
*/ |
| 24 |
function gamipress_wp_job_manager_get_post_term_ids( $post_id, $taxonomy ) { |
| 25 |
$terms = get_the_terms( $post_id, $taxonomy ); |
| 26 |
return ( empty( $terms ) || is_wp_error( $terms ) ) ? array() : wp_list_pluck( $terms, 'term_id' ); |
| 27 |
} |