[wp-trac] [WordPress Trac] #38557: Format for registering a default header image is ambiguous

WordPress Trac noreply at wordpress.org
Mon Oct 31 20:46:13 UTC 2016


#38557: Format for registering a default header image is ambiguous
--------------------------+------------------------------
 Reporter:  bradyvercher  |       Owner:  pento
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by bradyvercher):

 [attachment:38557.3.diff] moves the replacement logic to
 `get_theme_support()`, which has a few advantages:

 * Automatically works for the default image in the custom background
 feature, too
 * Is easier to unit test since `add_theme_support( 'custom-header' )`
 can't be tested
 * Doesn't modify the format of data stored in the `$_wp_theme_features`
 global

 The two things that could potentially be considered breaking changes:

 * Calling `get_theme_support( 'current-header', 'default-image' )` will
 return the full URL instead of potentially returning a string with
 `sprintf` placeholders. I think this is a bug fix since core expects it to
 return a full URL in a couple of places.
 * The data stored in `$_wp_default_headers` is modified on assignment to
 consolidate the replacement logic for registered default headers. If the
 global shouldn't be changed, introducing a helper function to retrieve the
 values would be possible.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38557#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list