acf_field_post_object::get_post_title
This function post object's filtered output post title
Метод класса: acf_field_post_object{}
Хуки из метода
Возвращает
Строку. A potentially user filtered post title for the post, which may contain unsafe HTML.
Использование
$acf_field_post_object = new acf_field_post_object(); $acf_field_post_object->get_post_title( $post, $field, $post_id, $is_search, $unescape );
- $post(WP_Post) (обязательный)
- The WordPress post.
- $field(массив) (обязательный)
- The field being output.
- $post_id(int)
- The post_id to which this value is saved to.
- $is_search(int)
- An int-as-boolean value for whether we're performing a search.
- $unescape(true|false)
- Should we return an unescaped post title.
По умолчанию:false
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_field_post_object::get_post_title() acf field post object::get post title ACF 6.4.2
public function get_post_title( $post, $field, $post_id = 0, $is_search = 0, $unescape = false ) {
// get post_id
if ( ! $post_id ) {
$post_id = acf_get_form_data( 'post_id' );
}
// vars
$title = acf_get_post_title( $post, $is_search );
// unescape for select2 output which handles the escaping.
if ( $unescape ) {
$title = html_entity_decode( $title );
}
// filters
$title = apply_filters( 'acf/fields/post_object/result', $title, $post, $field, $post_id );
$title = apply_filters( 'acf/fields/post_object/result/name=' . $field['_name'], $title, $post, $field, $post_id );
$title = apply_filters( 'acf/fields/post_object/result/key=' . $field['key'], $title, $post, $field, $post_id );
// return untrusted output.
return $title;
}