I want to get items of my wp primary menu. I tried some code but all of them are returns only blank page. I don’t know which method I must use and don’t know need include any other page to my page?
And Is there any way to get menu items from database directly without using wp methods and functions? I couldn’t understand table structure of wp for now. So I don’t know relationships between tables exactly.
Thanks.
You can try this
You will get your menu Object
refer : http://wiki.workassis.com/wordpress-get-menu-array/
If you know your menu location id (usually declared in functions.php by “register_nav_menus”) you can use this snippet:
Or more short version from codex:
Then do everything you want with this array like so:
And here is link about all nav_menu data which you can select directly from database by mysql request:
http://lasota.community.uaf.edu/2011/07/29/nav-menu-data-location-in-wordpress-3-2/
You could do this:
If you want it as an array, just explode it and implode it after you are done:
In both cases, you would to replace
menuname
in the add_action hook for the name of the menu you are trying to get the items of.Use get_registered_nav_menus() function