AriAccess for developers

The [ariaccess_button] shortcode, the filters and actions, the REST route and the data AriAccess stores, as they are in the code.

  • Reference
  • AriAccess
  • 3 min read
  • Updated

Shortcode

[ariaccess_button] adds a button that opens the display panel, for example in a menu, footer or post. It has one attribute:

AttributeDefaultWhat it does
labelDisplay settingsThe button text.
[ariaccess_button label="Display settings"]

The button has the class ariaccess-open for styling. It works only on pages where the panel loads, so keep Show the display panel button on and at least one option on. To show only your own button, hide the floating button (#ariaccess .ariaccess-trigger) in your theme CSS.

Filters

FilterParametersWhat it filters
ariaccess_capability$cap (string)Capability for the Fixes, Display panel, Statement and Settings tabs. Default manage_options.
ariaccess_check_capability$cap (string)Capability for running checks and seeing reports. Default edit_others_posts.
ariaccess_post_types$types (string[])Post types the content check covers.
ariaccess_rules$rules (array, id => rule)The content check rules. Each rule has title, wcag (string[]), type (error, warning or notice), why and fix.
ariaccess_analyze$issues (array), $xp (DOMXPath), $root (DOMElement)Issues found in one post. $issues is rule id => [ 'count' => int, 'samples' => string[] ]. Add your own checks here; a rule id must exist in ariaccess_rules to be reported.
ariaccess_theme_colors$colors (array: text, background)Colours assumed when content sets only one of them. Default from your theme's global styles, or #000000 and #ffffff.
ariaccess_palette$palette (array, slug => colour)Theme palette colours used by the contrast check.
ariaccess_toolbar_modules$modules (array, key => [ label, type ])Display panel options and their labels. Only the 19 built-in keys can be switched on in settings.
ariaccess_toolbar_active$active (bool)Whether the display panel loads on this request.
ariaccess_admin_tabs$tabs (array, slug => [ label, capability ])The admin tabs. Render a tab you add with the action ariaccess_admin_tab_{slug}.
add_filter( 'ariaccess_post_types', function ( $types ) {
	$types[] = 'product';
	return $types;
} );

Actions

ActionParametersWhen it fires
ariaccess_loadedNoneAriAccess has loaded (on plugins_loaded).
ariaccess_post_scanned$post_id (int), $record (array)A post has been checked. $record has time, version, issues and counts.
ariaccess_page_scanned$scan (array)A page check result has been saved. $scan has url, title, time, standard, violations, incomplete and passes.
ariaccess_admin_tab_{slug}NoneRenders a tab added through ariaccess_admin_tabs.

REST route

POST /wp-json/ariaccess/v1/page-scan saves a page check result. The page check calls it from the browser; you do not normally need it. The user needs the check capability, and the request needs a wp_rest nonce.

ParameterTypeRequiredWhat it is
urlstringYesThe checked page. Must be on this site.
violationsarrayNo (default empty)Each item: id, impact, help, helpUrl, nodes, wcag. Up to 100 are kept.
titlestringNoPage title.
incompleteintegerNoNumber of results that need a human check.
passesintegerNoNumber of rules that passed.

Stored data

NameWhereWhat it holds
ariaccess_settingsOptionAll settings.
ariaccess_statementOptionStatement form answers and the statement page ID.
ariaccess_page_scansOptionPage check results, the latest 200 pages.
_ariaccess_scanPost metaContent check result for a post.
_ariaccess_dismissedPost metaDismissed rule IDs for a post.
ariaccess_error_countTransientNumber of problems shown on the admin menu.
ariaccessVisitor's browser (localStorage)The visitor's display panel choices.

With Delete all AriAccess data when the plugin is deleted ticked, deleting the plugin removes all of these from your database. The statement page and alt text stay.

Still stuck?

Our helpdesk answers on working days, Norwegian time. Include your WordPress version, PHP version and the page address.

Submit a ticketor email info@arihub.com