Opened 10 years ago
Last modified 5 years ago
#28904 new defect (bug)
custom header stores full URL in database
Reported by: | tverlaan | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9.1 |
Component: | Themes | Keywords: | dev-feedback needs-patch |
Focuses: | template | Cc: |
Description
set_header_image is storing the full URL to the custom header in the database. It should only store the relative path in the database and get_header_image should prepend the relative path with get_bloginfo('url'). This makes migrating your site easier. Or you can have a develop and live environment with an easy database sync (my particular issue).
set_header_image
Replace:
$choice['url'] = esc_url_raw( $choice['url'] );
With:
$choice['url'] = str_replace( get_bloginfo('url'), '', esc_url_raw( $choice['url'] ) );
or find another method of getting the relative URL
header_image
then add the bloginfo URL to header_image (and probably a few other places).
function header_image() { echo esc_url( get_bloginfo('url').get_header_image() ); }
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Why not use
content_url()
?For back compat we'd have to add a check if the URL we're appending is indeed relative.