Is there any way that you can edit a WordPress menu through code, when creating a plugin?
My goal is to show a menu-item at the end of the primary menu, where you can edit your profile information. I only want this behavior if the plugin is activated.
Any thoughts on this one? It should be used in the plugin and NOT in the theme!
I would personally not recommend automatically adding the links when a plugin is initialized, especially if this plugin is going to be open and downloaded by many people, if its for a very specific theme then i would put it into the theme functions.php file to use.
There are a number of ways to do it with jQuery or PHP but there is a very simple solution to it within PHP which i think suits your needs best.
Use the snippet below:
This appends a new item onto the current nav menu items and then returns it back.
You may want to add in some code that does verification on the user being logged in etc.