acf_field_wysiwyg::format_value
This filter is applied to the $value after it is loaded from the db, and before it is returned to the template
Метод класса: acf_field_wysiwyg{}
Хуки из метода
Возвращает
Разное. $value The modified value
Использование
$acf_field_wysiwyg = new acf_field_wysiwyg(); $acf_field_wysiwyg->format_value( $value, $post_id, $field, $escape_html );
- $value(разное) (обязательный)
- The value which was loaded from the database.
- $post_id(разное) (обязательный)
- The
$post_idfrom which the value was loaded. - $field(массив) (обязательный)
- The field array holding all the field options.
- $escape_html(true|false) (обязательный)
- Should the field return a HTML safe formatted value.
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_wysiwyg::format_value() acf field wysiwyg::format value ACF 6.4.2
public function format_value( $value, $post_id, $field, $escape_html ) {
// Bail early if no value or not a string.
if ( empty( $value ) || ! is_string( $value ) ) {
return $value;
}
if ( $escape_html ) {
add_filter( 'acf_the_content', 'acf_esc_html', 1 );
}
$value = apply_filters( 'acf_the_content', $value );
if ( $escape_html ) {
remove_filter( 'acf_the_content', 'acf_esc_html', 1 );
}
// Follow the_content function in /wp-includes/post-template.php
return str_replace( ']]>', ']]>', $value );
}