From 673a951d0f56b954cfe13853cf74a2eff510a81b Mon Sep 17 00:00:00 2001 From: Gregory Pradun Date: Wed, 6 Jul 2022 18:39:20 +0300 Subject: [PATCH] LAW-5676 --- htdocs/wp-content/themes/lawcarta/functions.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/wp-content/themes/lawcarta/functions.php b/htdocs/wp-content/themes/lawcarta/functions.php index 8735961..aa83bb9 100644 --- a/htdocs/wp-content/themes/lawcarta/functions.php +++ b/htdocs/wp-content/themes/lawcarta/functions.php @@ -363,4 +363,19 @@ function mark_redirected_user(){ setcookie('law_'.LAWCARTA_ENVIRONMENT_NAME, 1,0,"/", $cookieDomain); } } -add_action( "template_redirect", "mark_redirected_user" ); \ No newline at end of file +add_action( "template_redirect", "mark_redirected_user" ); + +function old_post_url_redirect(){ + global $wp; + $parts = explode('/',$wp->request); + if( + $parts + && count($parts) == 4 + && is_numeric($parts[0]) + && is_numeric($parts[1]) + && is_numeric($parts[2]) + ){ + wp_redirect( home_url( $parts[3] ), 301 ); + } +} +add_action( "template_redirect", "old_post_url_redirect" ); \ No newline at end of file