Skip to content

Instantly share code, notes, and snippets.

@tinjaw
Created August 18, 2020 20:57
Show Gist options
  • Save tinjaw/5da8ef61d91b73ca928256bb51200117 to your computer and use it in GitHub Desktop.
Save tinjaw/5da8ef61d91b73ca928256bb51200117 to your computer and use it in GitHub Desktop.
A plugin for YOURLS to: Send a 302 (temporary) redirect instead of 301 (permanent) for sites where shortlinks may change
<?php
/*
Plugin Name: Always-302 Plugin
Plugin URI: https://gist.github.com/tinjaw/5da8ef61d91b73ca928256bb51200117
Description: Send a 302 (temporary) redirect instead of 301 (permanent) for sites where shortlinks may change
Version: 1.0
Author: Tinjaw
Author URI: https://github.com/tinjaw
*/
// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();
yourls_add_filter( 'redirect_code', 'tinjaw_302_redirection' );
function tinjaw_302_redirection( $code, $location ) {
return 302;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment