0

I am trying to retrieve a list of all the admin menu labels and links on the front-end so I can add them to my admin bar menu. I don't need the submenus. I was hoping to access global $menu, but it just returns null. Perhaps there is another way? Tried via admin-ajax as well, also returning null. And nothing is stored to my knowledge in the database. Any suggestions?

2
  • 1
    those globals/APIs are admin APIs and may not exist or be used on the frontend, e.g. plugins usually register admin menus only in the admin and on admin only hooks that don't run on the frontend
    – Tom J Nowell
    Feb 19 at 17:52
  • @TomJNowell, thanks. I did a workaround by saving the admin menu links as a site option and then pulling them from there on the front-end. 👍
    – Aristocles
    Feb 21 at 16:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.