WP_Privacy_Policy_Content::add() WordPress Method

This function allows you to add content to the Privacy Policy page. The first parameter is the content you wish to add, and the second parameter is an optional priority number. The higher the priority number, the higher up on the page your content will appear.

WP_Privacy_Policy_Content::add( string $plugin_name, string $policy_text ) #

Add content to the postbox shown when editing the privacy policy.


Description

Plugins and themes should suggest text for inclusion in the site’s privacy policy. The suggested text should contain information about any functionality that affects user privacy, and will be shown in the Suggested Privacy Policy Content postbox.

Intended for use from wp_add_privacy_policy_content().


Top ↑

Parameters

$plugin_name

(string)(Required)The name of the plugin or theme that is suggesting content for the site's privacy policy.

$policy_text

(string)(Required)The suggested content for inclusion in the policy.


Top ↑

Source

File: wp-admin/includes/class-wp-privacy-policy-content.php

	public static function add( $plugin_name, $policy_text ) {
		if ( empty( $plugin_name ) || empty( $policy_text ) ) {
			return;
		}

		$data = array(
			'plugin_name' => $plugin_name,
			'policy_text' => $policy_text,
		);

		if ( ! in_array( $data, self::$policy_content, true ) ) {
			self::$policy_content[] = $data;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.9.6Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.