Skip to content

Instantly share code, notes, and snippets.

@erickarbe
Created March 27, 2013 19:31
Show Gist options
  • Save erickarbe/5257290 to your computer and use it in GitHub Desktop.
Save erickarbe/5257290 to your computer and use it in GitHub Desktop.
WordPress Logout Shortcode
//Logout Shortcode
function logout_func ($atts, $content = null) {
extract(shortcode_atts(array(
'linktext' => 'Log Out',
), $atts));
$logoutlink = wp_logout_url( home_url() );
return '<a href="' . $logoutlink . '" title="Logout">'. $linktext .'</a>';
}
add_shortcode( 'wplogout', 'logout_func' );
?>
// Example Usage:
// [wplogout linktext="YES"] - if you don't specify linktext, will just display "Log Out"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment