Declares a helper function for adding content to the Privacy Policy Guide.
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 on the Privacy Policy Guide screen. A plugin or theme can use this function multiple times as long as it will help to better present the suggested policy content. For example modular plugins such as WooCommerse or Jetpack can add or remove suggested content depending on the modules/extensions that are enabled.For more information see the Plugin Handbook: <a href="https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/">https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/</a>. The HTML contents of the $policy_text supports use of a specialized .privacy-policy-tutorial CSS class which can be used to provide supplemental information. Any content contained within HTML elements that have the .privacy-policy-tutorial CSS class applied will be omitted from the clipboard when the section content is copied. Intended for use with the 'admin_init' action.
Parameters
$plugin_namestring
The name of the plugin or theme that is suggesting content for the site's privacy policy.
$policy_textstring
The suggested content for inclusion in the policy.
Uses · 6
is_admin()Determines whether the current request is for an administrative interface page.
2416functionwp_add_privacy_policy_content($plugin_name,$policy_text){2417if(!is_admin()){2418_doing_it_wrong(2419__FUNCTION__,2420sprintf(2421/* translators: %s: admin_init */2422__('The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.'),2423'<code>admin_init</code>'2424),2425'4.9.7'2426);2427return;2428}elseif(!doing_action('admin_init')&&!did_action('admin_init')){2429_doing_it_wrong(2430__FUNCTION__,2431sprintf(2432/* translators: %s: admin_init */2433__('The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.'),2434'<code>admin_init</code>'2435),2436'4.9.7'2437);2438return;2439}24402441if(!class_exists('WP_Privacy_Policy_Content')){2442require_onceABSPATH.'wp-admin/includes/class-wp-privacy-policy-content.php';2443}24442445WP_Privacy_Policy_Content::add($plugin_name,$policy_text);2446}
History
Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-admin/includes/plugin.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.