acf/schema/output_format_choices

Last updated Mar 31, 2026

Overview

Filter available output format choices for a field type and property combination.

Description

This filter allows you to modify the list of output format choices available when configuring a field’s Schema.org property mapping. Formats determine how field values are transformed for JSON-LD output.

Changelog

  • Added in version 6.8.0

Parameters

apply_filters( 'acf/schema/output_format_choices', $choices, $field_type, $property );
  • $choices (array) Array of format choices (key => label)
  • $field_type (string) The ACF field type
  • $property (string) The Schema.org property name

Return

(array) The modified format choices array.

Example

This example adds a custom format option.

/**
 * Add custom output format choice.
 *
 * @param array  $choices    Format choices.
 * @param string $field_type The ACF field type.
 * @param string $property   The Schema.org property.
 * @return array Modified choices.
 */
function my_acf_schema_add_format( $choices, $field_type, $property ) {
    if ( $field_type === 'number' && in_array( $property, array( 'price', 'Offer.price' ), true ) ) {
        $choices['currency'] = 'Currency (with symbol)';
    }

    return $choices;
}
add_filter( 'acf/schema/output_format_choices', 'my_acf_schema_add_format', 10, 3 );

This example removes format options for specific properties.

/**
 * Limit format choices for duration properties.
 *
 * @param array  $choices    Format choices.
 * @param string $field_type The ACF field type.
 * @param string $property   The Schema.org property.
 * @return array Modified choices.
 */
function my_acf_schema_duration_formats( $choices, $field_type, $property ) {
    $duration_properties = array( 'prepTime', 'cookTime', 'totalTime', 'duration' );

    if ( in_array( $property, $duration_properties, true ) ) {
        // Only allow ISO 8601 duration format
        return array(
            'duration' => 'ISO 8601 Duration',
        );
    }

    return $choices;
}
add_filter( 'acf/schema/output_format_choices', 'my_acf_schema_duration_formats', 10, 3 );
Supercharge Your Website With Premium Features Using ACF PRO

Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.

Explore Features View Pricing

PRO Features
ACF Blocks
Options Pages
PRO Fields
Repeater
Flexible Content
Gallery
Clone

Related