By default, WordPress limits the users that are allowed to edit the privacy policy page, which has been defined in Settings > Privacy > Privacy Policy page. Only users that are allowed to change options (capability name: manage_options) are allowed to do that.

If you want that users with other permissions are able to edit that page, too, you need to adjust the capability. It’s a separate capability called manage_privacy_options, which then links to manage_options (or manage_network on multisite installations).

Here’s a function that can achieve that:

/** * Allow editing the privacy policy page for everyone. * * @see https://wordpress.stackexchange.com/a/325784/137048 * * @param array $caps All capabilities * @param string $cap Capability * @return string[] List of available capabilities */ function allow_editing_privacy_policy( array $caps, string $cap ): array { if ( $cap !== 'manage_privacy_options' ) { return $caps; } $cap_name = is_multisite() ? 'manage_network' : 'manage_options'; return array_diff( $caps, [ $cap_name ] ); } add_filter( 'map_meta_cap', 'allow_editing_privacy_policy', 1, 2 );
Code language: PHP (php)

In this case, the required capability gets removed completely, which means, that everyone is able to edit the privacy policy page that is also allowed to edit pages in general. You can also add another capability after you remove the original one to limit editing the privacy policy page to another capability:

/** * Allow editing the privacy policy page for everyone having the capability to edit theme options. * * @see https://wordpress.stackexchange.com/a/325784/137048 * * @param array $caps All capabilities * @param string $cap Capability * @return string[] List of available capabilities */ function allow_editing_privacy_policy( array $caps, string $cap ): array { if ( $cap !== 'manage_privacy_options' ) { return $caps; } $cap_name = is_multisite() ? 'manage_network' : 'manage_options'; $caps = array_diff( $caps, [ $cap_name ] ); $caps[] = 'edit_theme_options'; return $caps; } add_filter( 'map_meta_cap', 'allow_editing_privacy_policy', 1, 2 );
Code language: PHP (php)

In this case, a new capability edit_theme_options is added so the users need the capability to edit theme options in order to edit the privacy policy page.

Leave a Reply

Your email address will not be published. Required fields are marked *