There is a global variable containing the current page in the admin area, called $pagenow
. You can use this to detect where the user is now.
Now, in your case, you are on admin.php
and there are 3 parameters set in the URL, page
, delete
and id
. So:
if(
in_array( $pagenow, array('admin.php') ) &&
( $_GET['page'] == 'wpProQuiz' && $_GET['action'] == 'delete' && $_GET['id'] == '1' )
) {
// Now check the current user
$user = wp_get_current_user();
if ( $user->user_login == 'remo' ) {
wp_safe_redirect( admin_url() );
exit();
}
}
This will redirect the user back to their dashboard. Not that you don’t need to check the password, since the username is unique.
Related Posts:
- Allowing users to edit only their page and nobody else’s
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Hide Admin Menu for Specific User ID who has administrator Role
- How to customize wp_signon()
- Can I create users that have access to *some* other users posts instead of all other users posts?
- Set default page for user account in admin
- Hide everything on site for visitors except specific page IDs
- Managing Users and Creating Groups [closed]
- wordpress user roles are not working
- Displaying different in-page content to cliente/admin
- Problem with automatic role change through cron job
- How can I allow an User to publish only 5 posts per month?
- Where are $current_user->allcaps set?
- Allow admins to login as other users
- Can I Create a Second Admin Level User Role?
- WordPress user role with create user capability?
- Update user role for expired membership
- Custom User Role: Can Edit Own Page, Cannot Create New
- WordPress install checking permissions of user id 0
- Allowing users to edit only their page and nobody else’s
- How to bulk change user role to “No role for this site”
- Restrict Access to the User Profile
- Control Category of each user can post
- Limit user access to installing/configuring a plugin?
- Editor can create any new user except administrator
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- Remove Ability for Other Users to View Administrator in User List?
- How to restrict access to uploaded files?
- alphabetically order role drop-down selection in dashboard
- How to let contributors to create a new revision(draft) editing their published posts
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- How to check user role without using current_user_can()
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to assign capabilities to user NOT to User Role
- How to stop a user from updating the post date
- BuddyPress | Check if user is in current group [closed]
- Return ID of authors who have at least one post
- WordPress edit_user_profile_update update secondary role
- Front end user meta options for users
- How-to Delay The Capability To Publish Posts?
- How to get the Role Name of the current user? (WordPress)
- set_role has no effect
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- How do I list in the backend all users that were assigned to a custom role?
- How to add local users to wordpress without email password?
- Get User Role by ID not working
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- add_cap not working with Shop Manager role
- show text If special user is logged
- Upgrade Nightmare – No Posts, Permissions Issues and Can’t Create a new post
- remove/hide pages from users backend
- Allow user access to Dashboard only!
- Updating wp_user_level on user update
- Fix permissions for users role
- Add a role and give admin priviledges
- Create custom post with custom user rules
- How change user type from contributor to author
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- How many people are allowed to use same wordpress account at the same time?
- Restrict access to non-wordpress section of site with user roles?
- What’s the correct way to add capabilites to user roles?
- How to hide user profile fields based on the role of the viewed user?
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Does it matter if the very first user, usually Admin, does not have a user ID of 1?
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- Groups and subgroups for permission
- Redirect admin 403 “Cheatin uh?” admin pages
- One Click Access To Users Account In WordPress?
- how do I add role and capability after I create a new user
- Get Authors Role
- Editor role can only create/edit/delete users who have one of two roles
- User can’t search himself on rest api
- Find count of WordPress users by role and search string for user name
- Hook into add_user_role and update based on new and removed roles
- How to Moderate Edits to User Profiles?
- fine-grained capabilities for user related capabilities
- Create relationships between users or user roles
- Updated user role inncorrect when using wp_get_current_user()
- User Permissions on custom post type
- How to use url formatter with integer
- Show user details only
- throttle/limit a logged in user’s http requests to specific page on a per day basis
- Access level seems to have gone from admin to editor
- post acces for guests / unregistered users only
- Front end login and page restriction
- Limit roles displayed in users.php depending on custom role
- Creating Custom user type just like custom post
- view and update form only for registered users
- i need to let a user to add a role from a frontend form
- file upload user profile
- How to give different user access to different people?
- Show only users with the same role in Dashboard user list
- determine active user browser at the same time
- Wordpres password as plain text in email
- WordPress: New user role which is ONLY allowed to manage media