I currently have to do something like this
// stop wordfence onChange event.
// removes "Application passwords have been disabled by Wordfence" when the user changes the role select.
jQuery('#createuser #role').off('change');
// removes the table if it contins the string 'Wordfence'
// removes 2FA Grace Period checkbox table row
jQuery("#your-profile table:contains('Wordfence')").remove();
and it seems unreliable.
Hi @adarter, thanks for getting in touch.
Aside from the two examples given above which have been requested by customers before, which other specific instances of 2FA being mentioned would you like to remove? Please feel free to show me with screenshots using a service like Snipboard, as the links can be pasted here.
2FA can only be fully disabled in Wordfence in terms of functionality, and some display elements may remain, but hopefully using the type of methods above we can come to a solution with the other sections you wish to hide.
Thanks,
Peter.
1st instance (users.php)
https://i.snipboard.io/UO1lzB.jpg
Solution:
Add the following filters to hide Wordfence 2FA from the users table. It would be wise to check if the plugin is active using ‘is_plugin_active’ before running these filters.
<?php
add_filter( 'views_users', function ( $views ) {
unset( $views['wfls-active'] );
unset( $views['wfls-inactive'] );
return $views;
}, 999 );
add_filter( 'manage_users_columns', function( $columns = array() ){
unset( $columns['wfls_2fa_status'] );
return $columns;
}, 999 );
add_filter( 'user_row_actions', function ( $actions ) {
unset( $actions['wf2fa'] );
return $actions;
}, 999 );
2nd instance (user-new.php)
https://i.snipboard.io/1LfnlT.jpg
Solution:
use admin_enqueue_scripts hook to register a script file
jQuery('#createuser #role').off('change');
3rd instance (profile.php and user-edit.php)
https://i.snipboard.io/o5u0z1.jpg
Solution:
use admin_enqueue_scripts hook to register a script file
jQuery("#your-profile table:contains('Wordfence')").remove();