I can get the image header with



wp eval "echo get_header_image();"

But how can I change that ? I tried

set_header_image(url) and Custom_Image_Header::set_header_image

with no success.

  • are you using default theme or customized theme? – Wordpress Dev Aug 16 at 4:18
  • I installed a theme – yarek Aug 16 at 9:13
  • Which theme are u using? – Wordpress Dev Aug 16 at 9:14
  • Used theme: EnvestPro Lite. It is a classic theme where you set the image header in customize->theme->header – yarek Aug 16 at 13:01

get_header_image() uses get_theme_mod() to get the saved header image, so I would assume the following example should be used to update the saved value. And set_header_image does the same thing at the end of it, after all the different checks.

set_theme_mod( 'header_image' , 'your-image-url-here' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.