How to set a header image?

I can get the image header with get_header_image()ex:wp eval "echo get_header_image();"But how can I change th

I can get the image header with

get_header_image()

ex:

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.

I can get the image header with

get_header_image()

ex:

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.

Share Improve this question asked Aug 15, 2019 at 21:23 yarekyarek 1274 bronze badges 4
  • are you using default theme or customized theme? – Wordpress Dev Commented Aug 16, 2019 at 4:18
  • I installed a theme – yarek Commented Aug 16, 2019 at 9:13
  • Which theme are u using? – Wordpress Dev Commented Aug 16, 2019 at 9:14
  • Used theme: EnvestPro Lite. It is a classic theme where you set the image header in customize->theme->header – yarek Commented Aug 16, 2019 at 13:01
Add a comment  | 

1 Answer 1

Reset to default 0

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' );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745224728a4617407.html

相关推荐

  • How to set a header image?

    I can get the image header with get_header_image()ex:wp eval "echo get_header_image();"But how can I change th

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信