Ask logged in user to re-enter password to access page “x”

You have to get user’s hash (hash is encrypted password) from the database: get_currentuserinfo(); $user_hash = $current_user->user_pass_md5; Then check if it’s correct: wp_check_password( $password, $user_hash, $user_id ); $password – Plaintext user’s password from input $user_hash – Encrypted password from database $user_id – user ID I guess But as Mark said in comment – this is … Read more

Redirect admin 403 “Cheatin uh?” admin pages

Sounds like this is what you’re running into. admin_page_access_denied may be the hook you want to use for this. try function dont_show_cheatin_page() { if ( current_user_can( ‘do_not_allow’ ) ) { wp_safe_redirect( admin_url()); // custom redirect instead of Cheatin 403 page exit; } } add_action(‘admin_page_access_denied’, ‘dont_show_cheatin_page’);

How to restrict an admin page, if the user is not superadmin?

To remove from the admin menu, you could use remove_menu_page(): add_action( ‘admin_menu’, function ( ) { if (is_super_admin()) return; remove_menu_page(); // or remove_submenu_page( … },99); If for some reason the page still exists, it’s just missing it’s menu link, you could check the get_current_screen() to see if the page is being viewed, and prevent access: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)