[wp-trac] [WordPress Trac] #25156: get_custom_header() should return false when there is no header

WordPress Trac noreply at wordpress.org
Mon Sep 16 08:46:14 UTC 2013

#25156: get_custom_header() should return false when there is no header
 Reporter:  nacin             |       Owner:  kovshenin
     Type:  defect (bug)      |      Status:  reviewing
 Priority:  normal            |   Milestone:  3.7
Component:  Themes            |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |

Comment (by kovshenin):

 > Seems like we need to handle the case where get_theme_mod() returns
 false and there is no default-image or default random image.  Not sure if
 this does that.

 It does, but it returns an empty string, not false. `get_custom_header` on
 the other hand doesn't. Most themes check the result of `get_header_image`
 before running `get_custom_header`. However, looking around the themes
 directory I found at least five themes that attempt to access the
 properties of `get_custom_header` directly:

 * http://themes.svn.wordpress.org/_second-foundation/
 (old version)
 * http://themes.svn.wordpress.org/alexandria/2.0.1/slider-cheader.php
 * http://themes.svn.wordpress.org/aplau/1.2.1/header.php
 * http://themes.svn.wordpress.org/bitlumen/1.0.1/functions-settings.php
 * http://themes.svn.wordpress.org/spartan/1.2.32/archive.php

 As you mentioned, they'll trigger a notice, but I don't think it will
 really break anything because the image URL is empty either way. Still
 looking into default and random, maybe we should return false there for
 consistency too.

Ticket URL: <http://core.trac.wordpress.org/ticket/25156#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list