Created
July 27, 2025 16:00
-
-
Save 2ndkauboy/741683cf08072b9b37a395a078862e49 to your computer and use it in GitHub Desktop.
Allow editors to edit the content of the privacy policy page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Allow Privacy Policy Page Edits | |
| * | |
| * @package AllowPrivacyPolicyPageEdits | |
| * @author Bernhard Kau | |
| * @license GPL-2.0-or-later | |
| * | |
| * @wordpress-plugin | |
| * Plugin Name: Allow Privacy Policy Page Edits | |
| * Plugin URI: https://gist.github.com/2ndkauboy/741683cf08072b9b37a395a078862e49 | |
| * Description: Allow editors to edit the content of the privacy policy page. | |
| * Version: 1.0.0 | |
| * Requires at least: 4.9 | |
| * Author: Bernhard Kau | |
| * Author URI: https://kau-boys.de | |
| * License: GPL v2 or later | |
| * License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
| */ | |
| /** | |
| * Adjusts the capabilities required to edit the privacy policy page. | |
| * | |
| * @param string[] $caps Primitive capabilities required of the user. | |
| * @param string $cap Capability being checked. | |
| * | |
| * @return string[] Primitive capabilities required of the user. | |
| */ | |
| function allow_privacy_policy_page_edits( $caps, $cap ) { | |
| if ( $cap !== 'manage_privacy_options' ) { | |
| return $caps; | |
| } | |
| return array_diff( $caps, [ 'manage_options' ] ); | |
| } | |
| add_filter( 'map_meta_cap', 'allow_privacy_policy_page_edits', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For multisite its
manage_networknotmanage_options.I needed to do this for shop managers so I also wanted to add the cap to them and settled on this:
If you use this on your site you can remove the add_action after you have added it, then visited the admin panel once. You need to keep the map_meta_cap for every request though.