Only allow Application Passwords for admins?

[ad_1]

Add this code to your theme’s functions.php file or a custom plugin, not directly to the WordPress core files.

// Restrict Application Passwords feature to administrators only
function my_prefix_customize_app_password_availability($available, $user) {
    // Allow only users with the 'manage_options' capability (typically admins)
    return user_can($user, 'manage_options');
}
add_filter('wp_is_application_passwords_available_for_user', 'my_prefix_customize_app_password_availability', 10, 2);

Thread Starter
wzshop

(@wzshop)

Hi, thanks for getting back to me.
Your code does not work, it also seems to do the same as the code I mentioned?

Thanks

Thread Starter
wzshop

(@wzshop)

Apparently the above code (from my initial post) seems to work now. Had to do with a cache? Or maybe the code does not work when you try to connect with an earlier Application Password (a password that was generated before the code was added).

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer