最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp admin - How to load Dashboard default media files via HTTPS even when Browser URL has HTTP

programmeradmin0浏览0评论

How to load Dashboard default media files via HTTPS even when Browser AddressBar URL has HTTP

On all Admin Dashboard pages, I want to force the loading of all CSS, JS via https, even when URL in browser addressbar is using http.

Can this be done?

Currently, I have tried to hardcode in wp-login.php the default list of media files. This loads the hardcoded CSS/JS files via https even when its HTTP in Browser URL.

But, I cant go further into complex structure of wp-admin/ admin-header.php

I'm now looking into trying enqueue in my theme's function.php

/*Enqueue Admin CSS JS */
function wpdocs_selectively_enqueue_admin_script( $hook ) {
    wp_enqueue_script( 'default1', '.php?c=0&dir=ltr&load%5B%5D=dashicons,admin-bar,wp-pointer,common,forms,admin-menu,dashboard,list-tables,edit,revisions,media,themes,about,nav-menus,widgets&load%5B%5D=,site-icon,l10n,buttons,wp-auth-check&ver=5.2.6', array(), '1.0' );
    wp_enqueue_script( 'default2', '.css?ver=1591072501', array(), '1.0' );
    wp_enqueue_script( 'default3', '.1587658822.css?ver=7.4.7', array(), '1.0' );
    wp_enqueue_script( 'default4', '.1587658822.css?ver=7.4.7', array(), '1.0' );
}
add_action( 'admin_enqueue_scripts', 'wpdocs_selectively_enqueue_admin_script' );

PS: Media files discussed above are default System+Plugin CSS/JS files (and not custom css/js file)

PS: I dont want to force HTTPS in Browser AddressBar, only force HTTPS for the included media files.

发布评论

评论列表(0)

  1. 暂无评论