wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



rest_restrict_privacy_policy_page_setting_update › WordPress Function

Seit7.2.0
Veraltetn/v
rest_restrict_privacy_policy_page_setting_update ( $updated, $name )
Parameter: (2)
  • (bool) $updated Whether the setting update has already been handled.
    Erforderlich: Ja
  • (string) $name Setting name (as shown in REST API responses).
    Erforderlich: Ja
Gibt zurück:
  • (bool) Whether to short-circuit the update.
Definiert in:
Codex:

Prevents users without the `manage_privacy_options` capability from changing the privacy policy page through the REST API.

The settings endpoint only checks manage_options. On multisite the manage_privacy_options capability maps to manage_network, so a site administrator can read the setting but must not change it, matching the Settings > Privacy screen.


Quellcode

function rest_restrict_privacy_policy_page_setting_update( $updated, $name ) {
	if ( 'page_for_privacy_policy' === $name && ! current_user_can( 'manage_privacy_options' ) ) {
		return true;
	}
	return $updated;
}