
內容簡介
**總結:**
EndPointy Menus外掛可將您的WordPress導航菜單以JSON格式暴露在自訂REST API路徑上,讓您可以輕鬆讀取菜單結構。
**問題與答案:**
1. 什麼是EndPointy Menus外掛的基本名稱空間?
- 答:endpointy-menus/v1
2. GET /wp-json/endpointy-menus/v1/menus會返回什麼數據?
- 答:返回所有註冊的菜單,包括位置和項目。
3. 如何通過GET /wp-json/endpointy-menus/v1/menus/<id>來查詢特定菜單ID的單個菜單及其項目?
- 答:使用GET /wp-json/endpointy-menus/v1/menus/<id>。
4. 如何通過GET /wp-json/endpointy-menus/v1/locations來查詢所有註冊的菜單位置及分配的菜單?
- 答:使用GET /wp-json/endpointy-menus/v1/locations。
5. 如果想返回具有父子關係的分層樹結構的菜單項目,應如何使用Query Parameters?
- 答:使用nested=true,例如:/wp-json/endpointy-menus/v1/menus/2?nested=true。
6. 希望直接從前端應用程式或API客戶端使用這些URL,應如何處理?
- 答:直接使用提供的URL。
7. 若想支持開發者,可以通過哪些途徑進行支持?
- 答:網站:[https://gunjanjaswal.me](https://gunjanjaswal.me)
GitHub:[https://github.com/gunjanjaswal/Endpointy-Menus](https://github.com/gunjanjaswal/Endpointy-Menus)
Buy Me a Coffee:[https://buymeacoffee.com/gunjanjaswal](https://buymeacoffee.com/gunjanjaswal)
8. 如何貢獻或提交問題和功能請求給EndPointy Menus外掛?
- 答:透過GitHub:[https://github.com/gunjanjaswal/Endpointy-Menus](https://github.com/gunjanjaswal/Endpointy-Menus)
問題:[https://github.com/gunjanjaswal/Endpointy-Menus/issues](https://github.com/gunjanjaswal/Endpointy-Menus/issues)
外掛標籤
開發者團隊
原文外掛簡介
EndPointy Menus adds custom REST API routes to expose your WordPress navigation menus as JSON.
Base namespace: endpointy-menus/v1
Endpoints:
GET /wp-json/endpointy-menus/v1/menus
Returns all registered menus with locations and items.
GET /wp-json/endpointy-menus/v1/menus/
Returns a single menu and its items by menu ID.
GET /wp-json/endpointy-menus/v1/locations
Returns all registered menu locations with assigned menus.
GET /wp-json/endpointy-menus/v1/locations/
Returns a menu assigned to a specific location (e.g., ‘primary’, ‘footer’).
Query Parameters:
nested=true – Returns menu items in a hierarchical tree structure with parent-child relationships.
Example: /wp-json/endpointy-menus/v1/menus/2?nested=true
This is useful for headless WordPress setups or any external app that needs to read your menu structure.
Usage
Example requests:
Get all menus:
https://your-site.com/wp-json/endpointy-menus/v1/menus
Get single menu by ID:
https://your-site.com/wp-json/endpointy-menus/v1/menus/2
Get all menu locations:
https://your-site.com/wp-json/endpointy-menus/v1/locations
Get menu by location (e.g., ‘primary’):
https://your-site.com/wp-json/endpointy-menus/v1/locations/primary
Get nested menu structure:
https://your-site.com/wp-json/endpointy-menus/v1/menus/2?nested=true
https://your-site.com/wp-json/endpointy-menus/v1/locations/primary?nested=true
Use these URLs directly from your front-end application or API client.
Support the Developer
If you find this plugin useful, you can support the developer:
Website: https://gunjanjaswal.me
GitHub: https://github.com/gunjanjaswal/Endpointy-Menus
Buy Me a Coffee: https://buymeacoffee.com/gunjanjaswal
Contributing
Contributions, issues, and feature requests are welcome!
GitHub: https://github.com/gunjanjaswal/Endpointy-Menus
Issues: https://github.com/gunjanjaswal/Endpointy-Menus/issues
