{"id":12202,"date":"2022-05-11T04:57:45","date_gmt":"2022-05-11T08:57:45","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=12202"},"modified":"2022-05-11T04:57:48","modified_gmt":"2022-05-11T08:57:48","slug":"wordpress-programmatically-logout","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/wordpress-programmatically-logout\/","title":{"rendered":"How to Programmatically Logout in WordPress"},"content":{"rendered":"\n
Use this code snippet to programmatically logout in WordPress.<\/p>\n\n\n\n
The WordPress logout link:<\/p>\n\n\n\n
<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout<\/a><\/code><\/pre>\n\n\n\nWordPress programmatically logout function calls:<\/p>\n\n\n\n
wp_destroy_current_session();\nwp_clear_auth_cookie();\nwp_set_current_user( 0 );<\/code><\/pre>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,25,27,15,16],"tags":[136,350,433,452,471,544,651],"yoast_head":"\nWordPress Programmatically Logout Example<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n