All you need to do is to modify your method of restricting users.
add_action( 'admin_init', function() {
if ( (defined('DOING_AJAX') && DOING_AJAX) || ( strpos($_SERVER['SCRIPT_NAME'], 'admin-post.php') ) ) {
return;
}
if ( !current_user_can('manage_options') ) {
wp_redirect( home_url('/meu-perfil') );
exit();
}
}
Related Posts:
- ‘wp’ hook supposed to trigger when editing a post?
- How do I add something to the “Edit Tag” page in wp-admin?
- wp_list_tables bulk actions
- WordPress admin notice in plugin function
- How to remove items from +New admin menu?
- How to show an error message after publishing a post?
- Looking for a hook to add attachment information to the media library tab
- How to get the password and username of the add new user form (admin back end) in wordpress
- Adding body class to login page?
- How to change how long items are kept in the trash?
- Add “Page Revised” column to Admin
- Admin first hook that outputs HTML?
- Remove “Get Shortlink” button in admin of custom post type
- Display $pagenow error notice on all admin pages
- Can I edit the wp_post > post_content right before its inserted/updated?
- Stop loading “collaborators” users on add new post or page?
- How to check if upload window came from the featured image link?
- ‘wp_login’ action hook not working with wp-login.php file
- Stopping user deletion from running on error
- is_admin() not working when updating a post in the admin panel
- Enque script based on url paramater
- Can I hook into wp_update_core outside of the admin?
- Trying to get custom js files in my admin header
- Add and Remove Row Actions in an Existing WP_List_Table
- How can I prevent a function from loading in the admin screens?
- Adding JavaScript file in Admin Panel
- Restrict access to admin-post.php
- How to check if it’s edit.php & post_type is set?
- Add HTML to custom post type edit page
- admin_post_nopriv_{$action} is secure?
- Remove menu item dashboard for a unique user
- Check get_post value after wp-admin login
- Custom comment action
- Action for opening edit page in admin?
- plugin: ‘init’ hook, check if we’re not in admin
- How to prevent a user from updating other users in WordPress?
- is exposed wp-admin site a serious security vulnerability
- Ninja Forms: Front-End Forms, Post ID?
- /wp-admin/ – this link showing me “Index of /wp-admin”/ instead of dashboard
- fails upload images in posts + wp-admin/upload.php 403 error
- Add text when displying attribute with a hook on single product page
- Hooks to trigger a callback when adding, removing, rearranging or updating a widget in the widget area
- What methods are you using to transfer individual WP site components from one site to another?
- Searching for a custom meta from user.php in the admin
- Not receiving verification email to update administrator email in wordpress
- Featured image bugging out when using svg
- how to Hide all products except the General Manager role in the WordPress admin panel?
- WordPress site shows a white page for site/wp_admin. A login returns again to the login screen
- WordPress Localhost migration issue
- Https Website: CSS and JS files load in http and admin page does not load too
- Cannot Access wp-admin
- Is there a hook that I can use when a fatal error occurs?
- disable admin bar except administrator
- Function attached to cron job not running but will run if called manually
- Error 403 on wp-admin – Redirection to upgrade.php
- wp-admin is opening but the site isn’t opening
- Why does my function create extra empty files?
- Word press wp-admin redirecting to reauth=1
- Can’t access backend
- Admin utility classes?
- Can’t Access Wp-admin Login Page I get 500 error
- Can a user submit requests to wp-admin/admin.php without logging in?
- Unable to login or reset password via wp-admin
- when creating menu in wordpress it shows database can not be inserted
- WordPress Add/Edit Post right admin sidebar change title
- My wordpress admin backend doesnt go to links anymore
- Admin access to secondary site user_can_access_admin_page losing login
- Fresh Install – WP6 – Sorry, you are not allowed to access this page
- redirect wp-admin/profile.php to members/your-profile
- Administrator user cannot access dashboard after localwp import
- WP Admin Bar no longer appears in Dashboard
- WordPress Action Hook inside Classes
- Can no longer access Admin panel
- Unable to get the correct URL using get_the_post_thumbnail_url() in wp-admin
- WordPress change role from administrator to author by itself (automatically)
- Display SKUs in admin order list for new HPOS
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- admin_enqueue_scripts not load custom scripts from cdn
- WP dashboard messed up
- How to modify username before logging in?
- User can see and enter the WordPress Admin without login
- When typing, comment bar opens all the time in wp admin
- Impossible to access the site administration
- WooCommerce Webhook Action When a New Product Review was Submitted/Created
- Modify upload directory to use post category slug in file path on multisite installation
- How can I add classes to the Gutenberg iframe (editor-canvas) body tag? Added in WP 6.2(?)
- How to show always the top bar when editing
- How can I have an admin only non-dashboard page in my WordPress plugin
- Add a post when another post type is inserting
- Wildcard multisite wp-admin url wrongfully redirected
- login_enqueue_scripts changes are not reflecting
- Remove AM/PM in gutenberg add/edit post and use 24-h format
- check if the admin is inside the specific page on the back end
- Display Custom Text if date_picker date is expired
- Array() displaying in all pages of admin -view page source
- admin showing Array() after adding exit() code
- After changing http -> https -> http, I cannot access admin dashboard
- Can I get the role of the currentUser in modern WordPress React?
- Remove 3rd party plugin notices from within own plugin
- Is there a way to get the WP Admin Header to inject as the first element in the body instead of the last?