ACF\AI\GEO
Schema::get_priority_types
Get priority schema types for common use cases
Returns an array of commonly used Schema.org types that should be displayed first in selection dropdowns. When a context ID (field group ID) is provided, schema types from associated post types and blocks are prepended to the list.
Method of the class: Schema{}
Hooks from the method
Returns
Array. Array of priority type names.
Usage
$result = Schema::get_priority_types( $context_id ): array;
- $context_id(int)
- Optional field group ID to get context-aware priority types.
Changelog
| Since 6.8.0 | Introduced. |
Schema::get_priority_types() Schema::get priority types code ACF 6.8.8
public static function get_priority_types( int $context_id = 0 ): array {
$priority_types = array(
'Thing',
'Article',
'BlogPosting',
'NewsArticle',
'Recipe',
'Product',
'Event',
'HowTo',
'FAQPage',
'Person',
'Organization',
'LocalBusiness',
'Place',
'WebPage',
);
// Prepend context-specific schema types if a field group context is provided.
if ( $context_id ) {
$context_types = self::get_schema_types_from_field_group( $context_id );
if ( ! empty( $context_types ) ) {
$priority_types = array_unique( array_merge( $context_types, $priority_types ) );
}
}
/**
* Filter the priority Schema.org types
*
* Allows developers to customize which types appear first in selection lists.
*
* @param array $priority_types Array of priority type names.
* @param integer $context_id The field group ID providing context, or 0.
*/
return apply_filters( 'acf/schema/schema_priority_types', $priority_types, $context_id );
}