diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php
index 3eccc3cd80..02aa8a8794 100644
--- a/src/wp-admin/includes/misc.php
+++ b/src/wp-admin/includes/misc.php
@@ -204,6 +204,9 @@ function save_mod_rewrite_rules() {
global $wp_rewrite;
+ // Ensure get_home_path is declared.
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
+
$home_path = get_home_path();
$htaccess_file = $home_path . '.htaccess';
@@ -238,6 +241,9 @@ function iis7_save_url_rewrite_rules() {
global $wp_rewrite;
+ // Ensure get_home_path is declared.
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
+
$home_path = get_home_path();
$web_config_file = $home_path . 'web.config';
diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
index 7e660f064b..c898fc5169 100644
--- a/src/wp-admin/includes/plugin.php
+++ b/src/wp-admin/includes/plugin.php
@@ -2016,15 +2016,17 @@ function plugin_sandbox_scrape( $plugin ) {
}
/**
- * Helper function for adding content to the postbox shown when editing the privacy policy.
+ * Helper function for adding content to the Privacy Policy Guide.
*
* 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.
+ * 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:
+ * https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/.
*
* Intended for use with the `'admin_init'` action.
*
@@ -2032,9 +2034,32 @@ function plugin_sandbox_scrape( $plugin ) {
*
* @param string $plugin_name The name of the plugin or theme that is suggesting content for the site's privacy policy.
* @param string $policy_text The suggested content for inclusion in the policy.
- * For more information see the Plugins Handbook https://developer.wordpress.org/plugins/.
*/
function wp_add_privacy_policy_content( $plugin_name, $policy_text ) {
+ if ( ! is_admin() ) {
+ _doing_it_wrong(
+ __FUNCTION__,
+ sprintf(
+ /* translators: %s: admin_init */
+ __( 'The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.' ),
+ 'admin_init'
+ ),
+ '4.9.7'
+ );
+ return;
+ } elseif ( ! doing_action( 'admin_init' ) && ! did_action( 'admin_init' ) ) {
+ _doing_it_wrong(
+ __FUNCTION__,
+ sprintf(
+ /* translators: %s: admin_init */
+ __( 'The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.' ),
+ 'admin_init'
+ ),
+ '4.9.7'
+ );
+ return;
+ }
+
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
}