How to Disable Emojis in WordPress
Learn how to disable emojis in WordPress with this simple guide. Improve your site...

WPCodeBox
1044

Disable password reset functionality in WordPress. This guide explains how only users with administrator roles can change passwords from the admin area, enhancing WordPress security.
<?php
// In admin area
if ( is_admin() ) {
add_action( 'init', 'disable_password_fields', 10 );
function disable_password_fields() {
// if ( ! current_user_can( 'administrator' ) )
$show_password_fields = add_filter( 'show_password_fields', '__return_false' );
}
}
// Hide pass reset link on login screen
function remove_lostpassword_text ( $text ) {
if ($text == 'Lost your password?'){$text = '';}
return $text;
}
add_filter( 'gettext', 'remove_lostpassword_text' );
// Disable Password Reset URL & Redirect
function disable_lost_password() {
if (isset( $_GET['action'] )){
if ( in_array( $_GET['action'], array('lostpassword', 'retrievepassword') ) ) {
wp_redirect( wp_login_url(), 301 );
exit;
}
}
}
add_action( "login_init", "disable_lost_password" );





