Make WordPress Core


Ignore:
Timestamp:
04/01/2015 07:05:21 PM (10 years ago)
Author:
SergeyBiryukov
Message:

When shifting WP_Rewrite::flush_rules() to a later action if it was called too early, make sure to do a hard flush if requested.

props Denis-de-Bernardy, mordauk for initial patch.
fixes #30501.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rewrite.php

    r31459 r31964  
    20452045     * @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).
    20462046     */
    2047     public function flush_rules($hard = true) {
     2047    public function flush_rules( $hard = true ) {
     2048        static $do_hard_later;
     2049
    20482050        // Prevent this action from running before everyone has registered their rewrites
    20492051        if ( ! did_action( 'wp_loaded' ) ) {
    20502052            add_action( 'wp_loaded', array( $this, 'flush_rules' ) );
     2053            $do_hard_later = ( isset( $do_hard_later ) ) ? $do_hard_later || $hard : $hard;
    20512054            return;
     2055        }
     2056
     2057        if ( isset( $do_hard_later ) ) {
     2058            $hard = $do_hard_later;
     2059            unset( $do_hard_later );
    20522060        }
    20532061
Note: See TracChangeset for help on using the changeset viewer.