Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Last active December 22, 2025 07:01
Show Gist options
  • Select an option

  • Save aimahdi/eb78ee6c880b933a82884957ebd061d6 to your computer and use it in GitHub Desktop.

Select an option

Save aimahdi/eb78ee6c880b933a82884957ebd061d6 to your computer and use it in GitHub Desktop.
<?php
add_filter('fluent_cart/global_customer_menu_items', function ($items, $context) {
unset($items['downloads']);
return $items;
}, 10, 2);
add_action('template_redirect', function () {
if (is_admin()) {
return;
}
$slug = '';
if (class_exists('\FluentCart\Api\StoreSettings')) {
$slug = (new \FluentCart\Api\StoreSettings())->getCustomerDashboardPageSlug();
}
if (!$slug) {
return;
}
global $wp;
$requested = trim($wp->request, '/');
if ($requested === $slug . '/downloads' || $requested === $slug . '/downloads/') {
wp_safe_redirect(home_url("/{$slug}/"), 301);
exit;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment