From c43d9ccbdc730b59e73b1dba4ef3ff9ecfb5e07a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 22 Apr 2009 22:32:35 +0000 Subject: [PATCH] Always display the default header when previewing a theme. Props Viper007Bond. fixes #9152 git-svn-id: https://develop.svn.wordpress.org/trunk@11061 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/theme.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 48a8176101..ed3c21ebd6 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -875,15 +875,18 @@ function preview_theme() { if ( validate_file($_GET['template']) ) return; - add_filter('template', create_function('', "return '{$_GET['template']}';") ); + add_filter( 'template', create_function('', "return '{$_GET['template']}';") ); if ( isset($_GET['stylesheet']) ) { $_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']); if ( validate_file($_GET['stylesheet']) ) return; - add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") ); + add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") ); } + // Prevent theme mods to current theme being used on theme being previewed + add_filter( 'pre_option_mods_' . get_current_theme(), create_function( '', "return array();" ) ); + ob_start( 'preview_theme_ob_filter' ); } add_action('setup_theme', 'preview_theme');