mjkhajeh/wc-my-account-links
Composer 安装命令:
composer create-project mjkhajeh/wc-my-account-links
包简介
Remove, rename, and reorder WooCommerce My Account navigation links.
README 文档
README
Remove, rename, and reorder WooCommerce My Account navigation links from a polished admin UI.
Features
- Toggle visibility — show or hide any My Account navigation item with a single switch
- Rename items — set a custom label per item, or reset it back to the WooCommerce default with one click
- Drag-and-drop reordering — rearrange items without typing numbers or reloading the page
- Global reset — restore all WooCommerce defaults in one action
- Third-party plugin safe — endpoints added by other plugins are preserved unless you explicitly configure them
- Graceful degradation — does nothing harmful if WooCommerce is deactivated; shows a clear admin notice instead
Screenshots
Requirements
| Requirement | Version |
|---|---|
| WordPress | 6.0 or later |
| WooCommerce | Any recent version (must be active) |
| PHP | 7.4 or later |
Installation
Via WordPress admin (recommended)
- Go to Plugins → Add New → Upload Plugin
- Upload the
wc-my-account-links.zipfile - Click Install Now, then Activate
Manual install
- Clone or download this repository
- Copy the
wc-my-account-linksfolder to/wp-content/plugins/ - Activate the plugin through the Plugins menu in WordPress
Once activated, navigate to WooCommerce → My Account Links to configure the navigation.
Usage
- Open WooCommerce → My Account Links in the WordPress admin
- Toggle the switch in the Visible column to show or hide an item
- Type in the Custom Label field to rename an item (leave blank to keep the WooCommerce default)
- Drag the handle on the left to reorder items
- Click Save Settings in the sticky bar at the bottom
To undo all changes, click Reset All Defaults in the top-right corner of the page.
How It Works
Settings are stored in the WordPress Options table under the key mj_wc_account_links_settings and applied at runtime via the woocommerce_account_menu_items filter (priority 99). This means:
- Customisations survive WooCommerce updates
- No database schema changes are required
- The plugin has zero effect when WooCommerce is inactive
Option schema
{
"items": {
"<endpoint-slug>": {
"enabled": true,
"label": "Custom Label or empty string"
}
}
}
Project Structure
wc-my-account-links/
├── woocommerce-my-account-links.php Entry point, constants, Init class
├── class-mj-wc-account-links.php Core singleton — frontend filter & settings helpers
├── class-mj-wc-account-links-admin.php Admin page, save/reset handlers, notices
├── admin.js Drag-and-drop, toggle state, label reset, form submit
├── admin.css Admin UI styles (responsive, RTL-aware)
├── composer.json PSR-4 autoload config
└── readme.txt WordPress.org plugin readme
Hooks Reference
| Hook | Priority | Purpose |
|---|---|---|
plugins_loaded |
20 | Bootstrap; check WooCommerce is active |
admin_menu |
default | Register submenu under WooCommerce |
admin_enqueue_scripts |
default | Enqueue CSS/JS only on the plugin page |
admin_post_mj_wc_account_links_save |
— | Handle settings save form |
admin_post_mj_wc_account_links_reset |
— | Handle reset-all form |
woocommerce_account_menu_items |
99 | Apply saved settings on the frontend |
FAQ
Will my customisations survive a WooCommerce update?
Yes. Settings live in the WordPress Options table and are applied via a WooCommerce filter, so they persist across updates.
I have a third-party plugin that adds extra My Account items. Will they appear?
Yes. The plugin only modifies items it knows about. Any endpoint registered after your last save is appended in its default position. Visit the settings page and save again to take control of newly added items.
Can I reorder or hide the Logout link?
Yes — customer-logout is treated the same as any other endpoint.
What happens if I deactivate WooCommerce?
The plugin detects that WooCommerce is missing, shows an admin notice with options to install or activate it, and does nothing else.
Contributing
Pull requests are welcome. For significant changes, please open an issue first to discuss what you'd like to change.
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-change - Commit your changes:
git commit -m 'Add my change' - Push to the branch:
git push origin feature/my-change - Open a pull request
License
Licensed under the GNU General Public License v2.0 or later.
Author
MohammadJafar Khajeh — mjkhajeh.ir
Plugin page: wordpress.org/plugins/wc-my-account-links
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-06-20