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

How to load Dashboard default media files via HTTPS even when Browser AddressBar URL has HTTPOn all Admin Dashboard page

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.

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

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信