Skip to content

Instantly share code, notes, and snippets.

@ninnypants
Forked from whyisjake/sopa.php
Created January 18, 2012 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninnypants/1631218 to your computer and use it in GitHub Desktop.
Save ninnypants/1631218 to your computer and use it in GitHub Desktop.
SOPA Redirect - Fixed dates to be in the proper format
<?php
add_action( 'init', 'make_sopa_blackout' );
function make_sopa_blackout() {
if ( ! is_admin() ) {
$current_time = current_time( 'timestamp' );
$start_time = strtotime( '2012/01/17 8:00' );
$end_time = strtotime( '2012/01/17 20:00' );
if( $current_time >= $start_time && $current_time <= $end_time ) {
wp_redirect( 'http://oreilly.com/make-blackout.html', 503 );
exit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment