From 4b3be4e693dbdb06da4ae0fd5e7302ac89cf96ec Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Fri, 14 May 2010 16:55:26 +0000 Subject: [PATCH] Introduce __return_empty_array() and use it instead of create_function in the theme preview. git-svn-id: https://develop.svn.wordpress.org/trunk@14641 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 13 +++++++++++++ wp-includes/theme.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b048db3836..3cdf184e03 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4162,6 +4162,19 @@ function __return_zero() { return 0; } +/** + * Returns an empty array + * + * Useful for returning an empty array to filters easily + * + * @since 3.0.0 + * @see __return_zero() + * @return array Empty array + */ +function __return_empty_array() { + return array(); +} + /** * Send a HTTP header to disable content type sniffing in browsers which support it. * diff --git a/wp-includes/theme.php b/wp-includes/theme.php index bf3a778cac..3fb49b5df2 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1111,7 +1111,7 @@ function preview_theme() { } // Prevent theme mods to current theme being used on theme being previewed - add_filter( 'pre_option_mods_' . get_current_theme(), create_function( '', "return array();" ) ); + add_filter( 'pre_option_mods_' . get_current_theme(), '__return_empty_array' ); ob_start( 'preview_theme_ob_filter' ); }