How to Add a Log Out Link in the Admin Menu

Please enable the "Custom Code >> Code Snippets Manager" module and create the following PHP snippet. Set to be executed "Aways (on page load)" via the plugins_loaded hook, in the Admin area.

<?php
add_action( 'admin_menu', 'asenha_add_logout_admin_menu' );

function asenha_add_logout_admin_menu() {
    // 	Reference: https://developer.wordpress.org/reference/functions/add_menu_page/
    add_menu_page(
        __( 'Log Out', 'admin-site-enhancements' ), // Page title
        __( 'Log Out', 'admin-site-enhancements' ), // Menu title
        'read', // User capability required to view
        wp_logout_url(), // Menu slug
        '', // Callback
        'dashicons-exit', // Menu icon
        299, // Menu position. Just before "Show All/Less" from Admin Menu Organizer
    );	
}
 
Lifetime License
Available
envelopechevron-up