Maybe I am just not grasping the concept of WP right here but why is everything in Wordpress stored as a post of some type? I have a custom set of tables that house hundreds and thousands of items. I would like to programatically create a navigation menu that dynamically updates items to reflect my custom tables. I haven't been able to find a way to do this without using the following function:


To my understanding this function stores the item in the array in the wordpress tables as posts/taxonomies? This is needless overhead in my case and looks pretty permanent. My menu items will change pretty much on a daily basis, I don't want to grab items from one table only to have them stored in another table.

Does anyone know how I could directly update the navigation menu each time the homepage loads without requiring any interference from the administration panel?


  • Are your menus changing each time the page is refreshed? Commented Oct 9, 2012 at 20:35
  • to answer the question why WordPress stores menu items as posts- you can create menu items with titles that may differ from post titles, links to external content, nesting, ordering, custom css classes, etc., and the ability to have a single item appear (differently) in multiple menus. that data has to get stored somehow, it makes sense to reuse the same API to manage all of it in the same way pages, posts, tax, post meta, etc. are managed.
    – Milo
    Commented Oct 9, 2012 at 20:52
  • Pretty much, Brian. Milo, I still don't see why you can't fetch the links directly from the source and make it appear differently at run time? Maybe I am just thinking about this too programatically.
    – SPI
    Commented Oct 10, 2012 at 1:42

1 Answer 1


Filter wp_nav_menu_objects and add your custom items dynamically (see this example or this). You get the current list of items and the arguments wp_nav_menu() was with as parameters. Then you can just add new items or remove existing ones.

  • Thanks toscho, I had quite a messed up day trying to wrap my head around WP's way of manipulating things. I will try your methods in a couple of hours and hopefully end up accepting your answer :)
    – SPI
    Commented Oct 10, 2012 at 1:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.