Introduce remove_custom_background(). see #14903.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2e2ac55ced
commit
373a66db0f
|
@ -1474,7 +1474,7 @@ function remove_custom_image_header() {
|
|||
return false;
|
||||
|
||||
$callback = get_theme_support( 'custom-header' );
|
||||
remove_action( 'wp_head', $callback['callback'] );
|
||||
remove_action( 'wp_head', $callback[0]['callback'] );
|
||||
_remove_theme_support( 'custom-header' );
|
||||
remove_theme_support( 'custom-header-uploads' );
|
||||
|
||||
|
@ -1592,7 +1592,7 @@ function add_custom_background($header_callback = '', $admin_header_callback = '
|
|||
|
||||
add_action( 'wp_head', $header_callback );
|
||||
|
||||
add_theme_support( 'custom-background' );
|
||||
add_theme_support( 'custom-background', array( 'callback' => $header_callback ) );
|
||||
|
||||
if ( ! is_admin() )
|
||||
return;
|
||||
|
@ -1601,6 +1601,30 @@ function add_custom_background($header_callback = '', $admin_header_callback = '
|
|||
add_action( 'admin_menu', array( &$GLOBALS['custom_background'], 'init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove custom background support.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @see add_custom_background()
|
||||
*
|
||||
* @return bool Whether support was removed.
|
||||
*/
|
||||
function remove_custom_background() {
|
||||
if ( ! current_theme_supports( 'custom-background' ) )
|
||||
return false;
|
||||
|
||||
$callback = get_theme_support( 'custom-background' );
|
||||
remove_action( 'wp_head', $callback[0]['callback'] );
|
||||
_remove_theme_support( 'custom-background' );
|
||||
|
||||
if ( is_admin() ) {
|
||||
remove_action( 'admin_menu', array( &$GLOBALS['custom_background'], 'init' ) );
|
||||
unset( $GLOBALS['custom_background'] );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default custom background callback.
|
||||
*
|
||||
|
@ -1726,7 +1750,7 @@ function remove_theme_support( $feature ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes theme support internally, ignorant of the blacklist.
|
||||
* Do not use. Removes theme support internally, ignorant of the blacklist.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.1.0
|
||||
|
|
Loading…
Reference in New Issue