This fix is only available in paid versions of Accessibility Checker.
Are users uploading inaccessible PDFs to your website inviolation of accessibility guidelines? This article explains how you can restrict the ability to upload PDFs in WordPress to only users with a specific capability, limiting the ability for content authors to upload unapproved PDFs.
How to Block PDF Uploads in WordPress
If you want to block which user roles can upload PDFs to the WordPress media library, this can be easily be achieved using the paid version WordPress Accessibility Checker plugin.
Step 1
Click into the Accessibility Checker plugin settings in your WordPress dashboard (you must be logged in with an administrator account to access these settings).
Step 2
Go to the “Fixes” tab in the Settings Tabs navigation.
Step 3
Check the box for Block PDF Uploads, then scroll to the bottom of the page and click the “Save Changes” button.
What This Fix Does
When enabled, the Block PDF Uploads fix prevents non-administrator users from uploading PDF files to your site. This means, Editors, Authors, and any other user roles that have the ability to upload files will no longer be able to upload PDFs. If they attempt to upload a PDF, they will be presented with an error message and the file will be rejected.
WordPress admins will always be able to upload PDFs. If you want to grant other user roles this capability, you can do so adding a capability to the user role, as described below.
How to Grant PDF Upload Capabilities to Additional User Roles
By default, when enabled the Block PDF Uploads setting only allows PDFs to be uploaded by users with an “Administrator” user role. All other user roles will be unable to upload PDFs.
If you want to allow certain user roles, in addition to administrators, the ability to upload PDFs, then you can do this by granting those user roles the edac_upload_pdf
capability.
You can add capabilities to user roles with a plugin (no code) or by writing custom code in your theme functions file. The easiest way to add a capability to a user role is by using the free User Role Editor plugin available on WordPress.org.
For code examples on adding capabilities to user roles, see the Roles and Capabilities WordPress Developer Documentation.
Impact on Accessibility
Blocking PDF uploads helps maintain control over the types of content added to your website, ensuring that all uploaded files are thoroughly reviewed for accessibility.
PDF documents are often less accessible to users with disabilities, particularly when they aren’t created with accessibility in mind. They also can be annoying for all users to read on mobile phones as they are optimized for print and are not mobile responsive.
By restricting PDF uploads, you can reduce the chances of inaccessible content being added to your site, thereby improving the overall accessibility for your users.