Skip to content

Instantly share code, notes, and snippets.

@kellenmace
Created June 1, 2015 13:29
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 kellenmace/39baea193375507c1255 to your computer and use it in GitHub Desktop.
Save kellenmace/39baea193375507c1255 to your computer and use it in GitHub Desktop.
<?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