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.

git-svn-id: https://develop.svn.wordpress.org/trunk@43361 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2018-06-16 13:01:42 +00:00
parent 885cd0fb44
commit d99d403030
2 changed files with 34 additions and 3 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';