WordPress.org

Forums

[resolved] Open navigation item in a specific target (2 posts)

  1. leemon
    Member
    Posted 2 years ago #

    Hi!

    I'm wondering if there's a way to open a navigation item in a SPECIFIC target in WP. Using the Menu Editor, one can only open an item in a blank window ticking the "Open link in a new window/tab" checkbox.

    Any ideas?

    Thanks in advance

  2. leemon
    Member
    Posted 2 years ago #

    I found the solution:

    function my_setup_nav_menu_item($menu_item) {
       $menu_item->target = "target_name";
       return $menu_item;
    }
    add_filter('wp_setup_nav_menu_item', 'my_setup_nav_menu_item', 0);

Topic Closed

This topic has been closed to new replies.

About this Topic