acf_field_taxonomy::get_term_title
Returns the Term's title displayed in the field UI.
Method of the class: acf_field_taxonomy{}
Hooks from the method
Returns
string.
Usage
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->get_term_title( $term, $field, $post_id, $unescape );
- $term(WP_Term) (required)
- The term object.
- $field(array) (required)
- The field settings.
- $post_id(mixed)
- The post_id being edited.
- $unescape(true|false)
- Should we return an unescaped post title.
Default:false
Changelog
| Since 5.0.0 | Introduced. |
acf_field_taxonomy::get_term_title() acf field taxonomy::get term title code ACF 6.8.8
function get_term_title( $term, $field, $post_id = 0, $unescape = false ) {
$title = acf_get_term_title( $term );
// Default $post_id to current post being edited.
$post_id = $post_id ? $post_id : acf_get_form_data( 'post_id' );
// unescape for select2 output which handles the escaping.
if ( $unescape ) {
$title = html_entity_decode( $title );
}
/**
* Filters the term title.
*
* @date 1/11/2013
* @since 5.0.0
*
* @param string $title The term title.
* @param WP_Term $term The term object.
* @param array $field The field settings.
* @param (int|string) $post_id The post_id being edited.
*/
return apply_filters( 'acf/fields/taxonomy/result', $title, $term, $field, $post_id );
}