Skip to content

Instantly share code, notes, and snippets.

@charmoney
charmoney / M&D wp-config.php
Last active May 1, 2018 16:24 — forked from ltitus210/M&D wp-config.php
Support http and https concurrently in wp-config
<?php
/**
* Determine if the current request is SSL. Set $_SERVER['HTTPS'] for WordPress' build in is_ssl().
*
* @return True if the site uses ssl directly or through a load balancer
*/
function greenpeace_is_ssl() {
$is_ssl = (isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] )
|| (isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'])
@charmoney
charmoney / rocket-dreampress-expires.php
Last active March 3, 2017 23:12 — forked from Tabrisrp/rocket-dreampress-expires.php
Adjust expiration on HTML to prevent WP Rocket issue with DreamPress Varnish cache
<?php
add_filter('rocket_htaccess_mod_expires', 'wp_rocket_adjust_html_expire_dreampress');
/**
* Adjust expiration on HTML to prevent issue with Varnish cache
*
* @param string $rules htaccess rules.
* @return Updated htaccess rules
*/
function wp_rocket_adjust_html_expire_dreampress( $rules ) {