How can I jump to the first sub menu item of a top menu item in WordPress?
How can I jump to the first sub menu item of a top menu item in WordPress?
I have a WordPress site with a top menu, and some top menu entries have sub menus, like this:
top1
top2
top3
sub1
sub2
sub3
top4
top5
subs 1, 2 and 3 are sub menus of top3. top3 is actually empty, it just serves as a container for its 3 subs. I'd like to navigate automatically to sub1 when top3 is clicked.
I know that there's a solution for this, I've seen it many years ago but can't remember where...just a tiny snippet in functions.php.
Tried a shortcode with wp_redirect, but it doesn't work:
function goto_adresse_function() {
if (!is_admin()) {
wp_redirect( 'kontakt/adresse');
}
}
add_shortcode('goto_adresse', 'goto_adresse_function');
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand