[wp-hackers] Shortcodes in Custom Menu Items

Nicholas Ciske nl at thoughtrefinery.com
Thu May 30 21:28:11 UTC 2013

Oops, had an extra http:// in there due to the way URLs get sanitized.

Moving the code to a gist:

Out of curiosity, why not just use a relative URL like /test/ vs inserting the site url in front?

Nick Ciske

On May 30, 2013, at 4:14 PM, Nicholas Ciske wrote:

> add_filter('wp_nav_menu', 'menu_shortcodes');
> function menu_shortcodes( $menu ){
> 	return str_replace( '_SITEURL_', home_url(), do_shortcode( $menu ) );
> }
> This will allow you to have site agnostic URLs and shortcodes in labels. Tweak as needed.

More information about the wp-hackers mailing list