Overview
Filter available Schema.org types in admin dropdowns.
Description
This filter allows you to modify the list of Schema.org types available in the admin UI when configuring post types and blocks. Types are organized in groups for easier navigation.
Changelog
- Added in version 6.8.0
Parameters
apply_filters( 'acf/schema/schema_types', $types );
$types(array) Hierarchical array of types grouped by category
Return
(array) The modified types array.
Example
This example adds custom Schema.org types.
/**
* Add custom Schema.org types.
*
* @param array $types Grouped array of Schema.org types.
* @return array Modified types array.
*/
function my_acf_schema_add_types( $types ) {
// Add custom types group
$types['Custom Types'] = array(
'SoftwareApplication' => 'SoftwareApplication',
'MobileApplication' => 'MobileApplication',
'WebApplication' => 'WebApplication',
);
return $types;
}
add_filter( 'acf/schema/schema_types', 'my_acf_schema_add_types' );
This example removes types not needed for your site.
/**
* Remove unused Schema.org types.
*
* @param array $types Grouped array of Schema.org types.
* @return array Modified types array.
*/
function my_acf_schema_remove_types( $types ) {
// Remove types we don't use
if ( isset( $types['Common Types'] ) ) {
unset( $types['Common Types']['Recipe'] );
unset( $types['Common Types']['Event'] );
}
return $types;
}
add_filter( 'acf/schema/schema_types', 'my_acf_schema_remove_types' );
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.
Related
- Filters: acf/schema/schema_properties
- Filters: acf/schema/schema_priority_types
- Filters: acf/schema/output_format_choices
- Filters: acf/schema/data
- Filters: acf/schema/block_field_objects/block_name={block_name}