• Is it somehow possible (with some hidden UI or a plugin or reasonably uncomplicated direct DB editing) to change the type of an existing nav menu item, e.g. to convert it from a “page” item to a “URL” item while keeping its database ID unchanged?

    Rationale: I am using several plugins that make it possible to store rather involved metadata in nav menu items, and I would like to avoid manually rebuilding all this metadata whenever I decide, for example, that I need to link to a specific anchor in the page instead of the page as a whole.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator cubecolour

    (@numeeja)

    I’m not quite sure what you are trying to achieve, however Mark Jaquith’s Page Links to plugin http://wordpress.org/plugins/page-links-to/ might help – which allows you to put a custom redirect in the page the menu item links to without affecting the menu.

    Thread Starter Rulatir

    (@rulatir)

    I am looking for a method to change the type (e.g. “page”, “category”, “tag”, “arbitrary URL”) of an existing menu item, without having to delete and recreate it, and so that its database ID remains unchanged.

    The very specific use case is converting a “page” item that points to http://mywordpress.example.com/mypage/ to an “arbitrary URL” item that points to http://mywordpress.example.com/mypage/#myjumplink. Alternatively, is there a plugin that enables adding jumplinks to “page” menu items?

    Moderator cubecolour

    (@numeeja)

    OK that clarifies what you’re aiming for now. I’m not aware of any plugin to do this, but I think it may be possible to approach this by adding a custom attribute to the Menu Items so you can enter the name of the anchor you want to target on the page, and then use a custom walker to build the menu appending this #anchor to the URL of each menu item where this has been specified.

    There are a few tutorials that cover custom attributes and making a custom walker, but I don’t think I’ve seen one that covers the exact functionality you require, however this one should get you started: http://www.wpexplorer.com/adding-custom-attributes-to-wordpress-menus/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change type of existing menu item?’ is closed to new replies.