我已经在Wordpress的常规设置中将我的Wordpress地址(URL)和网站地址(网址)更新为https://,因为我已经向主机添加了安全证书。
如果我使用,css url是否应该自动更新以反映新地址
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
在标题代码中。
url现在是https://,但css url仍然指向http://
您需要使用site_url($path_to_style_sheet, 'https')
而不是bloginfo()
。
home_url()
方法也支持https。
您应该使用:
<?php get_stylesheet_uri(); ?>
换句话说:
<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>" />