DocumentationReference
Filters
The 28 hooks the plugin exposes, what each one changes, and worked examples of the ones people reach for most.
The plugin exposes 28 filters. The list is generated from the source, so it is what is actually in the code.
Everything here is a WordPress filter: add a callback, return a modified value. Nothing requires a class to be extended or a file to be replaced.
Scanning
| Filter | What it changes |
|---|---|
wsak_allow_content_fallback | Whether a page may be checked against its stored content when the server cannot fetch the rendered page. |
wsak_browser_rules | The checks the browser pass performs. |
wsak_builder_content | The rendered output to scan for a page built by a page builder, rather than its stored post content. |
wsak_loopback_works | The verdict on whether this site can make HTTP requests to itself. Return null to let the plugin find out. |
wsak_page_html | The HTML a scan runs against, before any rule sees it. |
wsak_page_source_sslverify | Whether the loopback request verifies TLS. Useful on staging with a self-signed certificate. |
wsak_post_types | The post types the plugin knows about. |
wsak_readability_minimum_words | How many words a page needs before its reading level is measured. |
wsak_rules | The server-pass ruleset. |
wsak_scannable_post_types | Listing a site's content with what is known about each piece. |
wsak_template_representatives | Checking the theme once, instead of once per post. |
wsak_vague_link_phrases | The phrases treated as link text that does not say where it goes, such as "click here". |
Fixing
| Filter | What it changes |
|---|---|
wsak_can_dismiss | Whether a given user may dismiss a given finding as a false positive. |
wsak_can_dismiss_site_wide | Deciding about one piece of markup everywhere it appears. |
wsak_enabled_site_fixes | Switching site-wide fixes on and off, and running the ones that are on. |
wsak_may_upload_pdf | Stopping PDFs being added without anybody thinking about them. |
wsak_site_fixes | The site-wide fixes the plugin knows about. |
wsak_skip_link_applies | A skip link, for themes that have none. |
Reporting
| Filter | What it changes |
|---|---|
wsak_next_step | The one thing worth doing next. |
wsak_report_data | The data behind the report, before it is rendered or exported. |
wsak_report_formats | The formats a report can be exported as. |
wsak_scan_score | Scan result. |
wsak_simplified_summary | The plain-language summary shown for a page. |
wsak_statement_html | Accessibility statement rendering. |
Admin and access
| Filter | What it changes |
|---|---|
wsak_column_post_types | Accessibility state, in the lists people already look at. |
wsak_menu_position | Where the plugin sits in the admin menu. |
wsak_role_capabilities | Custom capabilities. |
wsak_services | Plugin orchestrator. |
Worked examples
Scan a custom post type
add_filter( 'wsak_post_types', function ( array $types ): array {
$types[] = 'product';
return $types;
} );
Only post types the current user may edit are ever offered, so this grants nobody access they did not already have.
Force a site-wide fix on
add_filter( 'wsak_enabled_site_fixes', function ( array $enabled ): array {
$enabled[] = 'skip-link';
return array_unique( $enabled );
} );
Let only administrators dismiss findings everywhere
add_filter( 'wsak_can_dismiss_site_wide', function ( bool $can, int $user_id ): bool {
return user_can( $user_id, 'manage_options' );
}, 10, 2 );
Let an editor run scans without seeing the whole report
The two capabilities exist to make exactly this distinction.
add_filter( 'wsak_role_capabilities', function ( array $map ): array {
$map['author'] = array( 'wsak_run_scan' );
return $map;
} );
Capabilities are granted when the filter runs and revoked on uninstall, so a role added here is cleaned up properly.
Work with a page builder the plugin does not know
add_filter( 'wsak_builder_content', function ( string $html, int $post_id ): string {
if ( ! my_builder_handles( $post_id ) ) {
return $html;
}
return my_builder_render( $post_id );
}, 10, 2 );
Allow scanning on a staging box with a self-signed certificate
add_filter( 'wsak_page_source_sslverify', '__return_false' );
Staging only. Turning off certificate verification in production is a bad trade.
Add a check of your own
add_filter( 'wsak_rules', function ( array $rules ): array {
$rules[] = new My_Rule();
return $rules;
} );
A rule implements the plugin’s Rule interface: an id, a WCAG success
criterion, a severity, whether it can be settled automatically, and the check
itself. Read an existing rule in src/Scanner/Rules/ before writing one — they
are short, and they are the best documentation of the interface.
The browser pass works the same way through wsak_browser_rules, with one
difference: a finding naming a check outside the registered list is discarded
rather than stored, because the browser is treated as an untrusted caller.
Last updated . Something here wrong or missing? Tell us and we will fix it.