/**
* Snippet Name: Custom Redirects
* Snippet Author: coding-bunny.com
* Description: Create and manage customized URL redirects.
*/
function cb_custom_redirects() {
// Get the current URL path without the base domain
$current_path = trim($_SERVER['REQUEST_URI'], '/');
// Redirect to new page
if ($current_path === 'about-us') {
wp_redirect('https://www.mysite.com/about-me', 301);
exit;
}
}
// Hook the redirect function to WordPress initialization
add_action('template_redirect', 'cb_custom_redirects');
Custom Redirects
Create and manage customized URL redirects.