This commit is contained in:
2026-04-26 23:47:49 +02:00
parent 1b95f03d1e
commit b073e009d8
5288 changed files with 1112699 additions and 55536 deletions

View File

@@ -664,7 +664,31 @@ function getObjectTerms( $taxonomy, $post_id ) {
return $results;
}
/**
* @param string $taxonomy Taxonomy name
*
* @return array Array of object term names and id
*/
function getObjectTermsWithId( $taxonomy, $post_id ) {
$terms = get_the_terms( $post_id, $taxonomy );
$results = array();
if ( is_wp_error( $terms ) || empty ( $terms ) ) {
return array();
}
// decode special chars
foreach ( $terms as $term ) {
$results[] = [
'name' => html_entity_decode( $term->name ),
'id' => $term->term_id
];
}
return $results;
}
/**
* Sanitize event name. Only letters, numbers and underscores allowed.
*