Skip to content

Instantly share code, notes, and snippets.

View gsusI's full-sized avatar
💭
🛫

Jesus Iniesta gsusI

💭
🛫
View GitHub Profile
@gsusI
gsusI / Make WordPress to use protocol relative urls
Created January 8, 2019 16:40 — forked from lgg/Make WordPress to use protocol relative urls
Make WordPress to use protocol relative urls
//make other links relative
add_filter ('site_url', 'wp_make_theme_links_protocols_relative');
add_filter ('get_option_siteurl', 'wp_make_theme_links_protocols_relative');
add_filter ('stylesheet_directory_uri', 'wp_make_theme_links_protocols_relative');
add_filter ('template_directory_uri', 'wp_make_theme_links_protocols_relative');
add_filter ('wp_get_attachment_url', 'wp_make_theme_links_protocols_relative');
add_filter ('wp_get_attachment_thumb_url', 'wp_make_theme_links_protocols_relative');
add_filter ('the_permalink', 'wp_make_theme_links_protocols_relative');
function wp_make_theme_links_protocols_relative( $link ){
$link = str_replace("http://", "//", $link);