Adding a relative custom menu link in WordPress Nav Menu

In case you want to stop WordPress putting the “http://” in your custom menu link:

Edit your wp-includes/nav-menu.php

Change the followin line:

update_post_meta( $menu_item_db_id, ‘_menu_item_url’, esc_url_raw($args[‘menu-item-url’]) );


update_post_meta( $menu_item_db_id, ‘_menu_item_url’, $args[‘menu-item-url’] );

That’s all

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.