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?
- Adding custom columns to custom post types
- Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?
- Is there a hook that runs after a user logs in?
- How to enqueue scripts on custom post add/edit pages?
- When moving a WP site, why does wp-admin redirect to old site?
- Why do some hooks not work inside class context?
- .htaccess in wp-admin produces a redirect loop
- Edit specific nodes in WP_Admin_Bar
- Add action hook conditionally – only when home.php in use
- How to check if which hook triggered the call to a function?
- Filter Custom Post Type in Admin
- Does WP fire delete_post when trashed posts are automatically deleted?
- Using the loop inside admin
- Easiest way to make post private by default
- How to make post and comment count unclickable with dashboard_glance_items hook
- How can I make my Admin Icon SVG color correctly? [closed]
- Is there any filter to disable the total fronted in WordPress
- Add column to pages table
- wp-admin – save options without refreshing?
- after login that will redirect user role into a page
- Change the Return URL from the Customizer
- Where can I edit Admin Panel Page file
- Create hooks based on an array of hook names?
- WordPress Error establishing a database connection For Admin login only
- Use external link in the add sub menu
- Image editing: “Edit Original” and “Replace” buttons missing on old posts
- WooCommerce – filter by featured products in admin
- How to prevent parent admin page from appearring as a child admin page
- WooCommerce add_action hook results in 500 error
- Replace wordpress login logo with custom text
- Create a plugin to change the action to which a function is hooked
- Failed to load resource admin-ajax.php
- WordPress Plugin Boilerplate – add_action hook in static “activate” function
- Custom WordPress Dashboard for Specific user role
- After login get “403 Forbidden”
- How to display a Ninja Form on the WordPress admin pages
- Why are my frontend theme styles bleeding into the backend?
- Show Welcome Panel on Dashboard for every user
- Is it possible to add an item the Post Publish panel?
- How to find hooks as per Just-In-Time approach?
- Can’t unregister parent theme’s CPT from my child theme
- add action for displaying posts using a shortcode
- Execute script only on certain admin pages
- Uncheck the box “Send User Notification” by default on new-user.php
- WordPress Options Page not working
- ‘wp’ action hook not firing in admin and login?
- Admin account locked out/redirect loop. Other accounts work?
- Add count for new registered user in Users tab
- WordPress filter that hook after each action/filter hook
- Don’t delete a page if it holds users
- How To Differentiate Drafted product and Publish Product through Color?
- Sortable columns and admin like interface for tables/report in custom plugin?
- Remove favorites action menu and screen options panel
- WP admin page gives 404
- No access local wordpress website after PC formating
- How to prevent the editor from redirecting to website within iframe?
- Set global $wp_query/$post variable for dynamic page generation
- Adding widgets to my plugin page instead of WordPress dashboard
- Why is server preventing admin styles? (Was: Where are WordPress sessions saved?)
- How can I replace dashboard.css and dashboard.min.css (not add new css)
- Modify custom field input data before creating a new post
- Comment search plugin
- wp-admin throwing 500 errors after update to 4.2.1
- I have 2 plugins using the same wp_login action hook and one is not working