diff --git a/wp-content/plugins/wporg-learn/inc/redirects.php b/wp-content/plugins/wporg-learn/inc/redirects.php index a52fd5fcb..91d820718 100644 --- a/wp-content/plugins/wporg-learn/inc/redirects.php +++ b/wp-content/plugins/wporg-learn/inc/redirects.php @@ -49,19 +49,36 @@ function wporg_learn_redirect_old_urls() { return; } - $redirects = array( - // Source => Destination, any characters after the source will be appended to the destination. - '/handbook' => 'https://make.wordpress.org/training/handbook/', - '/report-content-errors' => '/report-content-feedback', - '/social-learning' => '/online-workshops', + // Redirection arrays use the format Source => Destination + // Any characters after the source will be appended to the destination. + + $pages = array( + '/handbook' => 'https://make.wordpress.org/training/handbook/', + '/report-content-errors' => '/report-content-feedback', + '/social-learning' => '/online-workshops', + '/workshop/' => '/tutorial/', + '/workshop-presenter-application' => '/tutorial-presenter-application', + '/workshops' => '/tutorials', + ); + + $tutorials = array( '/tutorial/block-editor-01-basics/' => 'https://wordpress.tv/2021/06/18/shusei-toda-naoko-takano-block-editor-01-basics/', '/tutorial/block-editor-02-text-blocks/' => 'https://wordpress.tv/2021/06/03/shusei-toda-block-editor-02-text-blocks/', '/tutorial/ja-login-password-reset/' => 'https://wordpress.tv/2021/02/16/login-password-reset/', - '/workshop/' => '/tutorial/', - '/workshop-presenter-application' => '/tutorial-presenter-application', - '/workshops' => '/tutorials', ); + $courses = array( + '/course/simple-site-design-with-full-site-editing/' => '/learning-pathway/user/', + '/course/part-2-personalized-site-design-with-full-site-editing-and-theme-blocks/' => '/learning-pathway/user/', + '/course/part-3-advanced-site-design-with-full-site-editing-site-editor-templates-and-template-parts/' => '/learning-pathway/user/', + '/course/developing-with-the-wordpress-rest-api/' => '/course/beginner-wordpress-developer/', + '/course/converting-a-shortcode-to-a-block/' => '/course/beginner-wordpress-developer/', + '/course/a-developers-guide-to-block-themes-part-1/' => '/course/intermediate-theme-developer/', + '/course/a-developers-guide-to-block-themes-part-2/' => '/course/intermediate-theme-developer/', + ); + + $redirects = array_merge( $pages, $tutorials, $courses ); + // Use `REQUEST_URI` rather than `$wp->request`, to get the entire source URI including url parameters. $request = $_SERVER['REQUEST_URI'] ?? '';