[wp-trac] [WordPress Trac] #28904: custom header stores full URL in database

WordPress Trac noreply at wordpress.org
Mon Jul 14 21:43:17 UTC 2014


#28904: custom header stores full URL in database
--------------------------+-----------------------------
 Reporter:  tverlaan      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:  3.9.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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() );
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28904>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list