Halloween Sale 15% off Ends in See the plans
PHP

"Report an Accessibility Problem" Footer Link

Adds a small link at the bottom of every page inviting visitors to report accessibility barriers by email, with the page address filled in for you.

Don’t have WPIDE yet? Install it on your site

Code

// Email address (or contact page URL) for accessibility reports.
$wpide_a11y_contact = get_option( 'admin_email' );

add_action( 'wp_footer', function () use ( $wpide_a11y_contact ) {
    $page = home_url( add_query_arg( array() ) );

    if ( is_email( $wpide_a11y_contact ) ) {
        $url = 'mailto:' . antispambot( $wpide_a11y_contact ) . '?subject=' . rawurlencode( 'Accessibility problem' ) . '&body=' . rawurlencode( "Page: $page\n\nWhat happened:\n" );
    } else {
        $url = add_query_arg( 'page_url', rawurlencode( $page ), $wpide_a11y_contact );
    }

    printf(
        '<p class="wpide-a11y-report" style="text-align:center;font-size:14px;margin:1em 0;"><a href="%s">Report an accessibility problem on this page</a></p>',
        esc_url( $url, array( 'mailto', 'http', 'https' ) )
    );
}, 50 );

Notes

Change $wpide_a11y_contact to a dedicated inbox, or to the URL of a contact page.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.