Skip to content

Instantly share code, notes, and snippets.

@PeterBooker
PeterBooker / wp-cloudfront.php
Created July 24, 2014 17:09
Make WordPress fully comptible with AWS CloudFront, to use as a full-page caching solution.
<?php
/**
* Add Last-Modified and Cache-Control Headers to WP Responses
*/
function wp_cloudfront_filter_headers( $headers ) {
/*
* WP already sets Cache-Control headers to avoid caching in the admin.
*/
if ( is_admin() ) {
@PeterBooker
PeterBooker / url_validation.php
Last active August 29, 2015 14:01
WordPress URL Validation Function
<?php
/**
* Validate URLs
*
* @param string $url
* @param boolean $strict
* @return string|boolean
*/
function kbso_validate_url( $url, $strict = false ) {