Created
March 25, 2016 01:45
-
-
Save elhardoum/47a287202c5fba2fe776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('init', function() { | |
// rewriting site.ext/index.php?se_random_post=1 to site.ext/random/ | |
add_rewrite_rule( | |
'random/?$', | |
'index.php?se_random_post=1', | |
'top' | |
); | |
}); | |
add_filter('query_vars', function($vars) { | |
// saving the query variable for the rewrite rule | |
$vars[] = "se_random_post"; | |
return $vars; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment