Description
This filter allows you to modify the list of WordPress post statuses that Accessibility Checker will include in scans and accessibility reports. By default, Accessibility Checker scans content in the following five post statuses: publish, future, draft, pending, and private.
Using this filter you can add custom post statuses (such as those registered by third-party plugins or workflows) to be included in scans, or you can remove default statuses that you do not want scanned.
Note: This filter only affects the full site scanner. Accessibility Checker will still scan any individual page or post when it is opened in the editor, regardless of its post status. This is intentional — it allows content editors to get accessibility feedback on content at any stage of their workflow. If you need to delete the issues from the tables to clear them in reports you can use our WP-CLI commands.
Usage
add_filter( 'edac_scannable_post_statuses', 'my_custom_scannable_statuses' );
Parameters
| Parameter | Type | Description |
|---|---|---|
$scannable_post_statuses | array | Array of post status slugs that Accessibility Checker will scan. Default: [ 'publish', 'future', 'draft', 'pending', 'private' ] |
Examples
Add a custom post status
If your site uses a custom post status (for example, a “ready for review” status registered by an editorial workflow plugin), you can add it to the list of scanned statuses so Accessibility Checker evaluates that content too.
function my_add_custom_scannable_status( $statuses ) {
$statuses[] = 'ready_for_review'; // Replace with your custom post status slug.
return $statuses;
}
add_filter( 'edac_scannable_post_statuses', 'my_add_custom_scannable_status' );
Remove a post status from scanning
If you want to exclude certain statuses — for example, preventing Accessibility Checker from scanning drafts so reports only reflect content that is live or nearly live — you can remove a status from the array.
function my_remove_draft_scannable_status( $statuses ) {
return array_diff( $statuses, [ 'draft' ] ); // Remove 'draft' from scanned statuses.
}
add_filter( 'edac_scannable_post_statuses', 'my_remove_draft_scannable_status' );
Limit scanning to published content only
The following example replaces the entire list and limits Accessibility Checker to only scan content with a status of publish. This is useful if you want your accessibility reports and stats to reflect only what is currently visible to the public.
function my_published_only_scannable_statuses( $statuses ) {
return [ 'publish' ];
}
add_filter( 'edac_scannable_post_statuses', 'my_published_only_scannable_statuses' );
Note: Returning an empty array from this filter will prevent Accessibility Checker from scanning any content and no accessibility stats or reports will be generated.
Since
This filter was added in Accessibility Checker 1.29.0.
Source Code
This filter is located in get_scannable_post_statuses() in /admin/class-settings.php.