Skip to content

Instantly share code, notes, and snippets.

@ryanshoover
Created August 28, 2018 18:13
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 ryanshoover/685f3a81afeeaf7cdfb0a3d52a707077 to your computer and use it in GitHub Desktop.
Save ryanshoover/685f3a81afeeaf7cdfb0a3d52a707077 to your computer and use it in GitHub Desktop.
WP Plugin - stop removing trailing slash
<?php
/**
* The Bill Wizard Trailing Slash Fix
*
* @package bill-wizard-trailing-slash
* @author wpengine
* @license Proprietary
*
* @wordpress-plugin
* Plugin Name: The Bill Wizard Trailing Slash Fix
* Description: Stops WordPress from redirecting URLs away from having a trailing slash
* Version: 1.0
* Author: wpengine
* Author URI: https://wpengine.com
* License: Proprietary
*/
namespace BillWizardTrailingSlash;
add_action(
'template_redirect',
function() {
remove_action( 'template_redirect', 'redirect_canonical', 10 );
},
1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment