Skip to content

Commit a9d298d

Browse files
authored
Update force-https.php
1 parent eaac05c commit a9d298d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

force-https.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
return $overrides;
2828
}, 999 );
2929

30-
// enforce https dynamically via filters (does not modify database)
30+
// enforce https at the database level before wordpress processes these values
31+
// home_url and site_url should not be in force_https_securize_url because it would run on every call unnecessarily
3132
function force_https_filter_home( $value ) {
3233
return set_url_scheme( $value, 'https' );
3334
}
35+
3436
add_filter( 'pre_option_home', 'force_https_filter_home' );
3537
add_filter( 'pre_option_siteurl', 'force_https_filter_home' );
3638

@@ -72,7 +74,6 @@ function force_https_securize_url( $value ) {
7274
add_filter( 'embed_oembed_html', 'force_https_securize_url', 10 );
7375
add_filter( 'get_avatar_url', 'force_https_securize_url', 10 );
7476
add_filter( 'get_custom_logo', 'force_https_securize_url', 10 );
75-
add_filter( 'home_url', 'force_https_securize_url', 10 );
7677
add_filter( 'includes_url', 'force_https_securize_url', 10 );
7778
add_filter( 'login_redirect', 'force_https_securize_url', 10 );
7879
add_filter( 'logout_redirect', 'force_https_securize_url', 10 );
@@ -82,7 +83,6 @@ function force_https_securize_url( $value ) {
8283
add_filter( 'plugins_url', 'force_https_securize_url', 10 );
8384
add_filter( 'post_link', 'force_https_securize_url', 10 );
8485
add_filter( 'rest_url', 'force_https_securize_url', 10 );
85-
add_filter( 'site_url', 'force_https_securize_url', 10 );
8686
add_filter( 'tag_link', 'force_https_securize_url', 10 );
8787
add_filter( 'term_link', 'force_https_securize_url', 10 );
8888
add_filter( 'woocommerce_account_endpoint_url', 'force_https_securize_url', 10 );

0 commit comments

Comments
 (0)