Skip to content

Instantly share code, notes, and snippets.

@AndreaBarghigiani
Created February 18, 2020 14:12
Show Gist options
  • Save AndreaBarghigiani/4479f8ef1c105cff757edb1b36f667df to your computer and use it in GitHub Desktop.
Save AndreaBarghigiani/4479f8ef1c105cff757edb1b36f667df to your computer and use it in GitHub Desktop.
Aggiungere voce "Esci" nel menu nella theme_location primary. https://skillsandmore.org
<?php
add_filter( 'wp_nav_menu_items', 'sam_logout_menu', 10, 2 );
function sam_logout_menu( $items, $args ) {
if ( 'primary' == $args->theme_location ) {
$items .= '<li class="menu-item logout"><a href="'. wp_logout_url(home_url()) . '" >Esci</a></li>';
}
}
return $items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment