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?
- How to add “Stick this post to the front page” to front end?
- Publish author posts only with editor approval?
- 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
- How to restrict Front-End Editor on a page?
- How to assign user a role if none is present when logging in
- Using rewrite rule to access a view of a plugin from home page
- Specific post user permissions
- How can I let users to access plugin functions based on roles?
- Dynamic homepage according to user role
- Restricting users to a specific front end page [closed]
- Remove Adminstrator Hyperlink from a user having role to add and see users
- Enable comments for post with comments meta box removed
- How can I change plugin to give access to editor user role?
- Frontend editing, Frontend user dashboard
- How could I execute my plugin just in frontend (not in backend)
- Handling jQuery Component Collision
- Advanced Custom Fields/User Role Editor – how to hide ACF for certain users?
- How create a role with admin capability less 1 or 2?
- Update User Role
- How to achieve certain page (url) accessible to certain users
- How to make a customize role and view a specific plugins base on that role?
- Hook to plugins admin settings
- Implement Autocomplete for a custom field on WordPress Plugin Frontend
- how to give a user a role?
- How to add a full edit link to front-end editor?
- Page Restriction and Redirect for Particular Levels or user
- Show an image in my header.php
- Filter custom posts based on the user role of author
- Custom post type – no layout section of Document tab, and no author choice
- How can I restrict image upload dimensions for non-admin WordPress users?
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- How to create restrict content to users (by user, not by role)
- How to set add question capability for author role in wp pro quiz plugin
- How to create user that has permission to create new sites on WordPress with multisite option enabled?
- ob_start() combined with wp_query
- How do I log out users from a restricted page if they are already logged in on another device? [closed]
- Can I allow certain people to add/edit pages within a parent?
- Add script into front from my plugin
- Fullscreen Video/GIF Intro
- can i limit editing specific custom fields to certain roles?
- Add user role to generated plugin
- Is there any way to make myself an admin?
- Understanding State in WordPress Multisites
- Restrict content based on buy woocommerce product
- Allow only Admin role to access plugin settings/options page
- Front-end CSS Library for plugin [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?
- 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?
- 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?
- How to restrict a plugin from certain pages without editing its core
- Plugin privelages for “editors”
- Plugin access and Roles
- Plugin Hook When New Author Added
- Effeciently adding Checkboxes to TablePress table cells
- Show an admin menu item in Editor role
- Allow a particular user to access a particular plugin?
- 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
- How To Toggle User_Meta in frontend in a form using PHP
- How to create different views for different user roles?
- Public WP website with one area just for members
- 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
- User / membership Plugin [closed]
- 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
- Defined user role to access plugin’s pages
- Working on fixing wp-front-end-editor, encountering undefined index
- WordPress User Frontend Editing Custom Fields
- custom registration form [duplicate]
- Want to add post to user dashboard
- Allow a role to edit one specific plugin
- map urls to plugins
- WordPress Role Capability Restriction
- Sync roles across several plugins
- How to give access to the particular page in wordpress for specific username/email NOT roles [closed]
- How to disable plugin capability : “create new category”
- edit slider plugin capability for custom_role