|

How to Create a WordPress Logout Shortcode

//WordPress Logout Shortcode
function logout_func ($atts, $content = null) {
extract(shortcode_atts(array(
‘linktext’ => ‘Log Out’,
), $atts));
$logoutlink = wp_logout_url( home_url() );
return ‘‘. $linktext .’‘;
}
add_shortcode( ‘wplogout’, ‘logout_func’ );
?>

// Example Usage:
// [wplogout linktext=”YES”] – if you don’t specify linktext, will just display “Log Out”

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *