Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
Created July 27, 2025 16:00
Show Gist options
  • Save 2ndkauboy/741683cf08072b9b37a395a078862e49 to your computer and use it in GitHub Desktop.
Save 2ndkauboy/741683cf08072b9b37a395a078862e49 to your computer and use it in GitHub Desktop.
Allow editors to edit the content of the privacy policy page
<?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