WordPress: Give Editors Access to POST SMTP Maillog in WordPress

With a simple PHP add-on, you can give WordPress users with the "Editor" role access to the POST SMTP plugin's mail log, which is otherwise only available to administrators. The function below adds the necessary rights to the editor role so that they can view both the plugin's mail log and manage POST SMTP.

This feature is added in your theme's functions.php file and allows editors to access POST SMTP without needing administrator rights.

add_cap( 'manage_postman_smtp' );
$role_object->add_cap( 'manage_postman_logs' );
?>

To remove access again, you can use:

$role_object->remove_cap( 'manage_postman_smtp' );
$role_object->remove_cap( 'manage_postman_logs' );

The access rights added via this feature are permanently stored in the WordPress database and therefore do not need to be a permanent part of your theme. Once you run the function once, the permissions are stored until they are actively removed again. The function can therefore be removed from functions.php after it has been run.

If you later want to remove the rights from the editor role, you can add a similar function with remove_cap, run it once and then remove the code again.