WooCommerce 3.5.7我的账户页面标签点击仅刷新,无法正常切换求助
Hey there, let’s work through this frustrating My Account tab problem you’re facing. It’s odd that the tabs only refresh the page instead of switching content, especially since adding endpoints to the main menu works—let’s break down the fixes step by step:
1. Double-Check Your Permalinks (Most Common Fix!)
WooCommerce endpoints rely on WordPress’s permalink structure to work correctly. If you’re using the "Plain" permalink setting, endpoints won’t function as expected. Here’s how to fix it:
- Go to Settings > Permalinks in your WordPress dashboard.
- Select any option except "Plain" (like "Post name" is a safe choice).
- Click Save Changes—this will update your site’s rewrite rules, which is often enough to get the tabs working.
2. Rule Out Plugin Conflicts
Even if switching themes didn’t help, a third-party plugin might be interfering with WooCommerce’s endpoint functionality:
- Temporarily disable all plugins except WooCommerce.
- Test the My Account tabs again. If they work, re-enable plugins one by one, testing after each, to find the conflicting plugin.
- Once you identify it, check for updates, or reach out to the plugin’s developer for support.
3. Verify Your .htaccess File (Apache Servers)
If permalinks are set correctly but the issue persists, your .htaccess file might be missing the necessary rewrite rules for WooCommerce:
- First, back up your current
.htaccessfile (just in case). - Go back to Settings > Permalinks and click Save Changes again—this should regenerate the correct rules automatically.
- If that doesn’t work, manually add these rules to your
.htaccessfile:# BEGIN WooCommerce <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WooCommerce - For Nginx servers, ensure your server config includes this rewrite rule:
location / { try_files $uri $uri/ /index.php?$args; }
4. Check for Duplicate Endpoint Slugs
It’s possible that an endpoint slug (like orders or edit-account) is conflicting with another page/post slug on your site:
- Go to WooCommerce > Settings > Advanced.
- Look at each endpoint’s slug under the "Account endpoints" section.
- If any slug matches an existing page/post, change it to a unique value (e.g.,
my-ordersinstead oforders), then save your settings.
5. Clear All Caches
Cached content might be serving outdated link structures, preventing the tabs from working:
- Clear any plugin-based caches (like WP Rocket, W3 Total Cache).
- Clear server-level cache or CDN cache if you’re using one.
- Hard-refresh your browser (Ctrl+F5 or Cmd+Shift+R) before testing again.
6. Recreate the My Account Page
Sometimes the existing My Account page might have corrupted content or shortcode issues:
- Create a new page in WordPress, add the
[woocommerce_my_account]shortcode to its content. - Go to WooCommerce > Settings > Advanced > Page setup, select this new page as your "My account page".
- Save changes and test the tabs.
Bonus Note
Your WooCommerce version (3.5.7) is quite outdated—newer versions include bug fixes and improvements for endpoint functionality. If all the above steps fail, consider updating WooCommerce (just make sure to back up your site first!).
内容的提问来源于stack exchange,提问作者user10378034

