Privacy: Make sure wp_add_privacy_policy_content() does not cause a fatal error by unintentionally flushing rewrite rules outside of the admin context.

Add a `_doing_it_wrong()` message describing the correct usage of the function.

Props kraftbj, azaozz, SergeyBiryukov, YuriV.
Fixes #44142.
Built from https://develop.svn.wordpress.org/trunk@43361


git-svn-id: http://core.svn.wordpress.org/trunk@43189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2018-06-28 02:36:09 +00:00
parent 96bfb67e79
commit 40cfcfc222
3 changed files with 35 additions and 4 deletions

View File

@@ -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';