The next major release of Block Accessibility Checks will evolve the plugin’s functionality into a comprehensive Validation API. What started as a tool for validating block attributes now extends to post meta validation, giving you a unified system for ensuring data quality and accessibility across your entire WordPress editor experience.

Validation Beyond Blocks
Until now, Block Accessibility Checks has focused exclusively on validating content within WordPress blocks. But what about all those custom meta fields you’ve added to your posts? Album release dates, author bios, product SKUs—these fields are just as important for data quality and accessibility, yet they’ve lacked the same robust validation experience.
That changes in the next release. The new meta validation framework brings the familiar validation experience to post meta fields, complete with real-time feedback, visual indicators, and automatic post locking when required fields are missing or invalid.
How It Works
The meta validation system has two main pieces: server-side validation through the MetaValidation class, and client-side validation through JavaScript filters.
Server-side validation integrates directly with WordPress’s register_meta:
register_meta(
'post',
'band_record_label',
array(
'single' => true,
'type' => 'string',
'show_in_rest' => true,
'object_subtype' => 'band',
'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => MetaValidation::required(
'band',
'band_record_label',
array(
'error_msg' => __( 'Record Label is required.', 'example-plugin' ),
'warning_msg' => __( 'Record Label is recommended.', 'example-plugin' ),
'description' => __( 'The record label of the band', 'example-plugin' ),
'type' => 'settings',
)
),
)
);
Client-side validation provides real-time feedback using the ba11yc_validate_meta filter:
import { addFilter } from '@wordpress/hooks';
addFilter(
'ba11yc_validate_meta',
'example-plugin/validation',
(isValid, value, postType, metaKey, checkName) => {
if (postType !== 'band') {
return isValid;
}
switch (metaKey) {
case 'band_record_label':
if (checkName === 'required') {
return !!(value && value.trim());
}
break;
// Add more cases
}
return isValid;
}
);
When required fields have validation errors, publishing and saving are disabled until issues are resolved. Meta validation checks appear alongside block checks in the plugin settings page, where you can configure each check’s severity (error, warning, or disabled).

Looking Ahead
This release represents a significant expansion of Block Accessibility Checks beyond just blocks. The meta validation system opens up new possibilities for ensuring data quality and accessibility throughout the WordPress editor experience.
We’re excited to see how the community uses these new features and we welcome your feedback, bug reports, and contributions on GitHub.
Leave a Reply