WordPress.org

Make WordPress Core

Ticket #9152: 9152.3.patch

File 9152.3.patch, 1.0 KB (added by Viper007Bond, 9 years ago)

Always display the default header when previewing a theme

  • wp-includes/theme.php

     
    854854        if ( validate_file($_GET['template']) )
    855855                return;
    856856
    857         add_filter('template', create_function('', "return '{$_GET['template']}';") );
     857        add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
    858858
    859859        if ( isset($_GET['stylesheet']) ) {
    860860                $_GET['stylesheet'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['stylesheet']);
    861861                if ( validate_file($_GET['stylesheet']) )
    862862                        return;
    863                 add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
     863                add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
    864864        }
    865865
     866        // Prevent theme mods to current theme being used on theme being previewed
     867        add_filter( 'pre_option_mods_' . get_current_theme(), create_function( '', "return array();" ) );
     868
    866869        ob_start( 'preview_theme_ob_filter' );
    867870}
    868871add_action('setup_theme', 'preview_theme');