0

I'm working on a Multisite where each site has its own header image. I have a staging and production setup where everything is edited on staging. A new site gets created and it has its own header image, all good.

But when I go to move to production, doing a staging database file export, changing the domain names for production, and then importing that database file to the production server those header images are missing.

In the WP-Admin it sees the Previously uploaded image and the src is empty. I get img src="" on inspection of the element.

Anyone else have this experience or something similar? In my functions.php I've added custom-header theme support.

// Add custom header support
add_theme_support( 'custom-header' );

This might be where I'm going wrong but I also have this in the custom-header.php

function my_network_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'my_network_custom_header_args', array(
    'default-image'          => 'http://mynetwork.com/wp-content/uploads/my-logo-default.png',
    'default-text-color'     => '000000',
    'width'                  => 736,
    'height'                 => 220,
    'flex-height'            => true,
    'wp-head-callback'       => 'my_network_header_style',
 )));
}
add_action( 'after_setup_theme', 'my_network_custom_header_setup' );

I recently added a default image so at least the page doesn't look broken and that works.

Any suggestions for how debug this issue? Maybe it's my callback that's missing something.

5
  • When you changed your domain in the database, how did you do it? Did you do a basic search replace in a query? Or did you use one of the proper tools? Custom headers aren't saved as URLs, they're attachment IDs
    – Tom J Nowell
    Commented Aug 4, 2017 at 21:21
  • I've started using sed in the Terminal, but that's a a basic search and replace. Thanks @TomJNowell that might give me a place to start!
    – kaplan
    Commented Aug 4, 2017 at 21:25
  • @TomJNowell what would be a proper tool?
    – kaplan
    Commented Aug 4, 2017 at 21:33
  • PHP serialised data cant be search replaced as the length of the data matters, if it changes the data structure becomes invalid. Use WP CLI to do a search replace instead as it does the necessary handling
    – Tom J Nowell
    Commented Aug 4, 2017 at 21:54
  • I use the WP Clone plugin to move a site from one place to another. Does all the URL changes needed, etc. Easy to use. Commented Aug 4, 2017 at 22:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.