acf_field_oembed::format_value
This filter is appied to the $value after it is loaded from the db and before it is returned to the template.
Method of the class: acf_field_oembed{}
No Hooks.
Returns
mixed. the modified value
Usage
$acf_field_oembed = new acf_field_oembed(); $acf_field_oembed->format_value( $value, $post_id, $field );
- $value(mixed) (required)
- The value which was loaded from the database.
- $post_id(mixed) (required)
- The
$post_idfrom which the value was loaded. - $field(array) (required)
- The field array holding all the field options.
Changelog
| Since 3.6 | Introduced. |
acf_field_oembed::format_value() acf field oembed::format value code ACF 6.8.8
public function format_value( $value, $post_id, $field ) {
// bail early if no value
if ( empty( $value ) ) {
return $value;
}
// prepare field to correct width and height
$field = $this->prepare_field( $field );
// get oembed
$value = $this->wp_oembed_get( $value, $field['width'], $field['height'] );
// return
return $value;
}