+ ' . __( 'Lorem ipsum dolor sit amet consectetuer id elit enim neque est. Sodales tincidunt Nulla leo penatibus Vestibulum adipiscing est cursus Nam Vestibulum. Orci Vivamus mollis eget pretium dictumst Donec Integer auctor sociis rutrum. Mauris felis Donec neque cursus tellus odio adipiscing netus elit Donec. Vestibulum Cras ligula vitae pretium Curabitur eros Nam Lorem eros non. Sed id mauris justo tristique orci neque eleifend lacus lorem.' ) . "
\n";
+ $content .= '
' . __( 'Sed consequat Nullam et vel platea semper id mauris Nam eget. Sem neque a amet eu ipsum id dignissim neque eu pulvinar. Mauris nulla egestas et laoreet penatibus ipsum lobortis convallis congue libero. Tortor nibh pellentesque tellus odio Morbi cursus eros tincidunt tincidunt sociis. Egestas at In Donec mi dignissim Nam rutrum felis metus Maecenas. Sed tellus consectetuer.' ) . "
\n";
+ $content .= '
' . __( 'Justo orci pulvinar mauris tincidunt sed Pellentesque dis sapien tempor ligula. Dolor laoreet fames eros accumsan Integer feugiat nec augue Phasellus rutrum. Id Sed facilisi elit mus nulla at dapibus ut enim sociis. Fringilla ridiculus dui justo eu Maecenas ipsum ut aliquet magna non. Id magna adipiscing Vestibulum Curabitur vel pretium ac justo platea neque. Maecenas Donec Quisque urna interdum.' ) . "
\n";
+ $content .= '
' . __( 'Tellus sagittis leo adipiscing ante facilisis Aliquam tellus at at elit. Ut dignissim tempus eu Fusce Vestibulum at eros ante dis tempus. Sed libero orci at id ut pretium metus adipiscing justo malesuada. In tempus vitae commodo libero In neque sagittis turpis In In. Eleifend elit dis ac eros urna auctor semper quis odio pretium. Ut Aenean cursus.' ) . "
\n";
+
+ /**
+ * Filters the default content suggested for inclusion in a privacy policy.
+ *
+ * @since 4.9.6
+ *
+ * @param $content string The defauld policy content.
+ */
+ return apply_filters( 'wp_get_default_privcy_policy_content', $content );
+ }
+
+ /**
+ * Add the suggested privacy policy text to the policy postbox.
+ *
+ * @since 4.9.6
+ */
+ public static function add_suggested_content() {
+ $content = self::get_default_content();
+ wp_add_privacy_policy_content( 'WordPress', $content );
+ }
+}
diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
index f2758ae1cd..cbf617fd96 100644
--- a/src/wp-admin/includes/plugin.php
+++ b/src/wp-admin/includes/plugin.php
@@ -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 );
+}
diff --git a/src/wp-admin/js/post.js b/src/wp-admin/js/post.js
index 553d3999f3..2f1f9509bb 100644
--- a/src/wp-admin/js/post.js
+++ b/src/wp-admin/js/post.js
@@ -1267,4 +1267,27 @@ jQuery(document).ready( function($) {
update();
} );
+
+ // Privacy policy postbox, copy button.
+ $( document ).on( 'click', function( event ) {
+ var $target = $( event.target );
+ var node, range;
+
+ if ( $target.is( 'button.privacy-text-copy-button' ) ) {
+ node = $target.parent().find( 'div.policy-text' )[0];
+
+ if ( node ) {
+ try {
+ window.getSelection().removeAllRanges();
+ range = document.createRange();
+ range.selectNode( node );
+ window.getSelection().addRange( range );
+
+ document.execCommand( 'copy' );
+ window.getSelection().removeAllRanges();
+ } catch ( er ) {}
+ }
+ }
+ });
+
} )( jQuery, new wp.utils.WordCounter() );
diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
index 96d5fc3fa4..bd8500e28d 100644
--- a/src/wp-includes/default-filters.php
+++ b/src/wp-includes/default-filters.php
@@ -552,4 +552,8 @@ add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 );
// Capabilities
add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 );
+// Trigger the check for policy text changes after active plugins change.
+add_action( 'update_site_option_active_sitewide_plugins', '_wp_privacy_active_plugins_change' );
+add_action( 'update_option_active_plugins', '_wp_privacy_active_plugins_change' );
+
unset( $filter, $action );
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index d53939caeb..6f9e77c5b7 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -6245,3 +6245,13 @@ function wp_privacy_anonymize_data( $type, $data = '' ) {
*/
return apply_filters( 'wp_privacy_anonymize_data', $anonymous, $type, $data );
}
+
+/**
+ * Trigger the check for policy text changes.
+ *
+ * @since 4.9.6
+ * @access private
+ */
+function _wp_privacy_active_plugins_change() {
+ update_option( '_wp_privacy_text_change_check', 'check' );
+}
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 365b14b317..e1d12f089f 100644
--- a/src/wp-includes/link-template.php
+++ b/src/wp-includes/link-template.php
@@ -4273,3 +4273,20 @@ function get_parent_theme_file_path( $file = '' ) {
*/
return apply_filters( 'parent_theme_file_path', $path, $file );
}
+
+/**
+ * Retrieves the URL to the privacy policy page.
+ *
+ * @since 4.9.6
+ *
+ * @return string The URL to the privacy policy page. Empty string if it doesn't exist.
+ */
+function get_privacy_policy_url() {
+ $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
+
+ if ( empty( $policy_page_id ) ) {
+ return '';
+ }
+
+ return get_permalink( $policy_page_id );
+}