Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active January 31, 2021 18:04
Show Gist options
  • Save westonruter/e5032d805625f0f743237708c43d3783 to your computer and use it in GitHub Desktop.
Save westonruter/e5032d805625f0f743237708c43d3783 to your computer and use it in GitHub Desktop.
<?php
/**
* AMP Mobile Server-Side Redirection plugin bootstrap.
*
* @package Google\AMP_Mobile_Server_Side_Redirection
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin
* Plugin Name: AMP Mobile Server-Side Redirection
* Plugin URI: https://gist.github.com/westonruter/e5032d805625f0f743237708c43d3783
* Description: Disable the default client-side JS-based mobile redirection in lieu of opt-in in to server-side HTTP redirects. The AMP plugin does client-side redirection by default since it is most compatible across various caching plugins, but if possible you should use server-side redirection because it is always faster.
* Version: 0.1
* Author: Weston Ruter, Google
* Author URI: https://weston.ruter.net/
* License: GNU General Public License v2 (or later)
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Gist Plugin URI: https://gist.github.com/westonruter/e5032d805625f0f743237708c43d3783
*/
add_filter( 'amp_mobile_client_side_redirection', '__return_false' );
@westonruter
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment