[wp-trac] [WordPress Trac] #20871: Removing header image does not remove header_image_data theme mod
WordPress Trac
wp-trac at lists.automattic.com
Fri Jun 8 01:13:38 UTC 2012
#20871: Removing header image does not remove header_image_data theme mod
-----------------------------+------------------
Reporter: kovshenin | Owner:
Type: defect (bug) | Status: new
Priority: highest omg bbq | Milestone: 3.4
Component: Appearance | Version: 3.4
Severity: blocker | Resolution:
Keywords: |
-----------------------------+------------------
Comment (by nacin):
[attachment:20871.2.diff] is a necessary cleanup of the Custom_Header
class to abstract all theme mod changes into four distinct functions:
removing an image, resetting an image, choosing an existing image (from
the page), and selecting a new image (from the media library or view an
upload). The documentation:
{{{
/**
* Remove a header image.
*
* @since 3.4.0
*/
final public function remove_header_image()
/**
* Reset a header image to the default image for the theme.
*
* This method does not do anything if the theme does not have a default
header image.
*
* @since 3.4.0
*/
final public function reset_header_image()
/**
* Choose a header image, selected from existing uploaded and default
headers.
*
* @param string $choice Which header image to select. Allows for values
of 'random-default-image',
* for randomly cycling among the default images; 'random-uploaded-
image', for randomly cycling
* among the uploaded images; the key of a default image registered
for that theme; and
* the key of an image uploaded for that theme (the basename of the
URL).
*/
final public function choose_existing_header_image( $choice )
/**
* Select a header image, either newly uploaded or from the media library.
*
* @since 3.4.0
*
* @param array $args An array of arguments: attachment_id, url, width,
height. All are required.
*/
final public function select_new_header_image( $args )
}}}
Notably:
* It sets _wp_attachment_is_custom_header, which means the customizer
must stop doing this for headers. (But continue doing it for backgrounds.)
* The header_image_data theme mod is now removed when the header is
"removed".
* The header_image_data theme mod is now removed when either "random"
option is chosen (random of uploads, or random of defaults). This is not
actually going to get called in get_custom_header(), but it is good to
make sure the DB is up to date/accurate.
* esc_url_raw() is always used when saving data, rather than esc_url().
(This change is also made to backgrounds.)
* I think get_custom_header() and other header and background template
functions may need an esc_url() added, but I did not focus on that.
We will then need to implement a custom setting and/or control to leverage
these four methods in the customizer.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20871#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list