This will allow you to access post.php
and still restrict the back-end. You need have action, action name as delete
, post key and value, and wpnonce kay and value. Otherwise, it will redirect you to homepage.
function disable_wp_admin() {
if ( ! is_admin() )
return;
if ( current_user_can( 'manage_options' ) )
return;
if (( current_user_can( 'edit_posts' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ) )
return;
if ( 'post.php' == isset( $_REQUEST['action'] ) && 'delete' == $_REQUEST['action'] && isset( $_REQUEST['post'] ) && isset( $_REQUEST['_wpnonce'] ) )
return;
$redirect_to = home_url();
wp_redirect( $redirect_to );
exit;
}
add_action( 'init', 'disable_wp_admin' );
Related Posts:
- How to show private pages based on a user’s role?
- How to prevent a post from being deleted?
- Deactivate plugin for a specific user group
- How to add “Stick this post to the front page” to front end?
- Publish author posts only with editor approval?
- How can I modify the Capability needed to access a plugin’s options?
- Limit access to posts/pages by user roles
- Loading posts associated only to the logged in user on recent posts page
- Handling jQuery Component Collision
- WordPress Capabilities: edit_user vs edit_users
- Let readers suggest edits from the frontend
- Disable text tab on WordPress text-editor
- Allowing Custom Capability to Manage Plugin Options
- How to restrict Front-End Editor on a page?
- How can I limit functionality in one version of a plugin?
- Disable plugins for a specific user role
- User profiles and object associations
- How to assign user a role if none is present when logging in
- How to notify users of blog updates a la Admin Plugin Update notifications?
- Using rewrite rule to access a view of a plugin from home page
- Woocommerce: change user role after completing order
- Add user role to generated plugin
- Multisite – maximum number of users with specific role
- AJAX on Front-End Button Click not working – Custom Plugin
- Is there any way to make myself an admin?
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- Understanding State in WordPress Multisites
- Restrict content based on buy woocommerce product
- Allow only Admin role to access plugin settings/options page
- How to allow Contributors to publish articles after approval
- Front-end CSS Library for plugin [closed]
- Restricting page access [closed]
- Custom shortcode for displaying user based on a role parameter
- How I can change the required capability for an admin menu without editing the plugin file?
- Add User Role: Pre-saved in User-Meta [SOLVED]
- How to do the simplest possible frontend ajax call from a plugin?
- Multiple authors and readers restricted by role [closed]
- Custom Login page with custom redirects for each user?
- Enqueue script: link not working in page source
- Show WordPress Plugin Menu(Admin) To Editor
- Mutliple users editing single document in wordspress
- Show media-uploads to all users
- How to request admin-ajax.php correctly when wordpress URL and site URL are different?
- Remove specific administrator’s capability
- Plugin permissions for Editor role
- How to auto strip hyperlinks & images in wordpress post
- How To Create A File Archive in WordPress?
- Role based permission edit for plugins
- Create a link which allows visitors to disable a plugin?
- Categories from front-end, checkbox selection doesn’t work
- Creating teams of users in WordPress
- How to restrict a plugin from certain pages without editing its core
- WordPress Membership Plugin Advice [closed]
- How to hide plugin options for editors via functions.php
- Plugin privelages for “editors”
- Plugin access and Roles
- Plugin Hook When New Author Added
- Adding plugin editing capability for Author
- Effeciently adding Checkboxes to TablePress table cells
- Show an admin menu item in Editor role
- implement custom roles in custom plugin
- Push Contact form 7 variable to front end after submission
- Allow a particular user to access a particular plugin?
- See which user role / capability is needed to use a plugin
- Need help with Task assigning and rewarding as currency which withdrawable
- Adding shortcodes to multiple pages with function
- how to create user profile pages and display them based on users roles
- After reading 3 story by user ask for subscription popup
- Allow editor user to full permission to access plugin settings
- Allow a page to be edited by a specific custom role
- WordPress User profile with Avatar upload on the front end without plugin?
- WordPress website working fine on localhost but not displaying front pages on webhost
- How To Toggle User_Meta in frontend in a form using PHP
- How to make this custom capability work? [duplicate]
- How to create different views for different user roles?
- Public WP website with one area just for members
- Unset plugins on front-end belonging to specific category
- How can I disable access to plugin settings in wp admin for other roles
- How to fix blog article view and share #’s?
- Remove dashboard links from wordpress
- How to upload PDF from Front-End and post automatically?
- Disable plugin for administrator
- How do I restrict a second admin certain access?
- User / membership Plugin [closed]
- Restrict role to use a plugin
- What action or filter can I use to change all the html returned from server for a page?
- Front End Page Not Loading Header Footer
- What action/hook do I need to register to have my plugin handle front-end editing?
- Why user profile update creates Additional Capabilities
- ‘Easy Template Path Hints’ for WordPress?
- Overwrite user role
- Why doesn’t a form need an ‘action’ with a plugin that uses the post data?
- Run only on plug-in activation instead of wp_head
- How to add featured image on front end form?
- Allow non-admin users to access plug-in
- Defined user role to access plugin’s pages
- Different email notifications (about pending posts) to different users
- Hide some portion on single.php base on author
- AJAX doesn’t pass variables to the php function in the plugin
- Custom User Role