November 14, 2016 · WordPress
WordPress redirect URL by parse_request
add_filter('parse_request', function (&$wp){
$qry = $wp->matched_query;
if ( preg_match('/slug=(.+)/',$qry,$matches) ){ //Change it into your pattern
$slug = $matches[1];
$postID = getPostIDBySlug($slug); //Check another Blog post in blog.simplylouis.com
if ($postID != null ){
$wp->query_vars['p'] = $postID;
}
}
});