All public registration functions, registry methods, and contracts.
Register a validation check for a block type.
validation_api_register_block_check( string $block_type, array $args ): void| Parameter | Type | Description |
|---|---|---|
$block_type |
string |
Block type name (e.g., 'core/image'). |
$args |
array |
Check configuration (see Check Arguments). Must include 'namespace'. |
Register a validation check for a post meta field.
validation_api_register_meta_check( string $post_type, array $args ): void| Parameter | Type | Description |
|---|---|---|
$post_type |
string |
Post type (e.g., 'post', 'page'). |
$args |
array |
Check configuration. Must include 'namespace' and 'meta_key'. See Check Arguments. |
Register a validation check for the editor (document-level).
validation_api_register_editor_check( string $post_type, array $args ): void| Parameter | Type | Description |
|---|---|---|
$post_type |
string |
Post type (e.g., 'post', 'page'). |
$args |
array |
Check configuration (see Check Arguments). Must include 'namespace'. |
Initialize the Validation API plugin. Called internally on init. Not intended for external use.
validation_api_init_plugin(): voidAll registration functions accept an $args array with the following keys:
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
namespace |
string |
Yes | — | Identifier for the plugin registering this check |
name |
string |
Yes | — | Unique identifier for this check within its scope |
error_msg |
string |
Yes | — | Message shown when the check fails at error level |
warning_msg |
string |
No | Same as error_msg |
Message shown at warning level |
level |
string |
No | 'error' |
Severity: 'error', 'warning', or 'none' |
description |
string |
No | '' |
Human-readable description (shown in REST API, companion settings) |
priority |
int |
No | 10 |
Execution order (lower runs first) |
enabled |
bool |
No | true |
Whether the check is active |
Meta checks only:
| Key | Type | Required | Description |
|---|---|---|---|
meta_key |
string |
Yes | The post meta key to validate |
These are the internal registry singletons. Most integrations should use the global functions above. Registry methods are documented here for contributors and advanced use cases.
Singleton. Access via BlockRegistry::get_instance().
register_check( string $block_type, string $check_name, array $check_args ): bool
get_checks( string $block_type ): array
get_all_checks(): array
is_check_registered( string $block_type, string $check_name ): bool
get_check_config( string $block_type, string $check_name ): ?array
get_registered_block_types(): array
get_effective_check_level( string $block_type, string $check_name ): stringSingleton. Access via EditorRegistry::get_instance().
register_editor_check( string $post_type, string $check_name, array $check_args ): bool
get_editor_checks( string $post_type ): array
get_all_editor_checks(): array
get_editor_check_config( string $post_type, string $check_name ): ?array
get_effective_editor_check_level( string $post_type, string $check_name ): stringSingleton. Access via MetaRegistry::get_instance().
register_meta_check( string $post_type, string $meta_key, string $check_name, array $check_args ): bool
get_meta_checks( string $post_type ): array
get_all_meta_checks(): array
get_meta_check_config( string $post_type, string $meta_key, string $check_name ): ?array
get_effective_meta_check_level( string $post_type, string $meta_key, string $check_name ): stringReturns all registered checks across all three scopes.
Permission: manage_options
Response:
{
"block": {
"core/image": {
"alt_text": {
"level": "error",
"description": "Images must have alt text",
"error_msg": "This image is missing alt text.",
"warning_msg": "Consider adding alt text.",
"priority": 10,
"enabled": true,
"_namespace": "my-rules"
}
}
},
"meta": {
"post": {
"seo_description": {
"required": { ... }
}
}
},
"editor": {
"post": {
"heading_hierarchy": { ... }
}
}
}define( 'VALIDATION_API_VERSION', '1.0.0' );The current plugin version.