Created
June 1, 2015 13:29
-
-
Save kellenmace/39baea193375507c1255 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 | |
namespace IOCDF; | |
/** | |
* Rewrite post URLs that have a /news/%postname%/ structure | |
*/ | |
function rewrite_post_urls() { | |
add_rewrite_rule('^blog/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/?', 'index.php?/blog/year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&postname=$matches[4]', 'top'); | |
} | |
add_action('init', '\IOCDF\rewrite_post_urls'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment