Disable the privacy tools in WordPress
WordPress 4.9.6 and above will include five new GDPR tools: a privacy policy page, a privacy policy editing helper, a personal data export tool, a personal data erasure tool, and a permissions checkbox that is used with comments.
You can learn more about the release schedule and current feature set for WordPress 4.9.6 on the WordPress.org site.
On the WordPress VIP platform these tools will be disabled. On the VIP Go platform these tools will be available, but clients can choose to disable them. By default, the tools are disabled in Multisite for single-site administrators, but are still available for Super Admins.
You can use the map_meta_cap()
filter to hide the following tools for all users:
- privacy policy page
- privacy policy editing helper
- personal data export tool
- personal data erasure tool
If you just want to restrict access to a small group of users (admins for example) the user_has_cap()
filter would work as well, with some modifications.
/**
* Disable the privacy tools added in WordPress 4.9.6.
*
* @param array $required_capabilities The primitive capabilities that are required to perform the requested meta capability.
* @param string $requested_capability The requested meta capability
* @param int $user_id The user ID.
* @param array $args Adds the context to the cap. Typically the object ID.
*
* @return array The primitive capabilities that are required to perform the requested meta capability.
*/
function disable_496_privacy_tools( $required_capabilities, $requested_capability, $user_id, $args ) {
$privacy_capabilities = array( 'manage_privacy_options', 'erase_others_personal_data', 'export_others_personal_data' );
if ( in_array( $requested_capability, $privacy_capabilities ) ) {
$required_capabilities[] = 'do_not_allow';
}
return $required_capabilities;
}
add_filter( 'map_meta_cap', 'disable_496_privacy_tools', 10, 4 );
The permissions checkbox that is used with comments can be disabled using the comment_form_default_fields
filter.
Last updated: May 30, 2021