WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/16/2018 01:11:57 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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.
Merges [43361], [43362], [43363] to the 4.9 branch.
Fixes #44142.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/misc.php

    r43351 r43364  
    195195 *
    196196 * @global WP_Rewrite $wp_rewrite
     197 *
     198 * @return bool|null True on write success, false on failure. Null in multisite.
    197199 */
    198200function save_mod_rewrite_rules() {
     
    202204    global $wp_rewrite;
    203205
    204     $home_path = get_home_path();
    205     $htaccess_file = $home_path.'.htaccess';
     206    // Ensure get_home_path() is declared.
     207    require_once( ABSPATH . 'wp-admin/includes/file.php' );
     208
     209    $home_path     = get_home_path();
     210    $htaccess_file = $home_path . '.htaccess';
    206211
    207212    /*
     
    227232 * @global WP_Rewrite $wp_rewrite
    228233 *
    229  * @return bool True if web.config was updated successfully
     234 * @return bool|null True on write success, false on failure. Null in multisite.
    230235 */
    231236function iis7_save_url_rewrite_rules(){
     
    235240    global $wp_rewrite;
    236241
    237     $home_path = get_home_path();
     242    // Ensure get_home_path() is declared.
     243    require_once( ABSPATH . 'wp-admin/includes/file.php' );
     244
     245    $home_path       = get_home_path();
    238246    $web_config_file = $home_path . 'web.config';
    239247
Note: See TracChangeset for help on using the changeset viewer.