I’ve spent a couple of days googleling around, looking for a way to automatically add categories and authors to my custom menu as soon as they are created (the same way that pages are automatically added!), but so far no luck!
I’d really like for my client to not have to go to menu and add the category or the author to the menu manually every time a new one is created.
Any ideas?
You can use the filter hook
wp_get_nav_menu_items
to add new items in the WP Nav Menu.The follow example is to add the last posts in the nav menu.
You can add to this filter your custom function, like to add each post from author with a specific ID. The logic to add the posts is inside your custom function, like the follow example in
replace_placeholder_nav_menu_item_with_latest_post
.The source example is from Viper007Bond, see the post for more information about the code.