Skip to content

Commit

Permalink
Adding deprecated course redirects (#2884)
Browse files Browse the repository at this point in the history
* Adding deprecated course redirects

Fixes #2868

* Separating redirection arrays
  • Loading branch information
jonathanbossenger authored Sep 16, 2024
1 parent bcce0c1 commit ed7c0cc
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions wp-content/plugins/wporg-learn/inc/redirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? '';

Expand Down

0 comments on commit ed7c0cc

Please sign in to comment.