Privacy: add a postbox that is shown when editing the privacy policy page, and where plugins and core will output suggested content and additional privacy info. First run.

Props melchoyce, azaozz.
See #43620.

git-svn-id: https://develop.svn.wordpress.org/trunk@42980 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2018-04-16 08:52:18 +00:00
parent 1a40a17275
commit 257842079c
9 changed files with 526 additions and 2 deletions

View File

@@ -2014,3 +2014,22 @@ function plugin_sandbox_scrape( $plugin ) {
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
include( WP_PLUGIN_DIR . '/' . $plugin );
}
/**
* Helper function for adding plugin specific information to the postbox shown when editing the privacy policy.
*
* Intended for use with the `'admin_init'` action.
*
* @since 4.9.6
*
* @param string $plugin_name The plugin'as name. Will be shown in the privacy policy metabox.
* @param string $policy_text The content that should appear in the site's privacy policy.
* For more information see the Plugins Handbook https://developer.wordpress.org/plugins/.
*/
function wp_add_privacy_policy_content( $plugin_name, $policy_text ) {
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
}
WP_Privacy_Policy_Content::add( $plugin_name, $policy_text );
}