It’s done with wp_die()
.
Something along these lines:
if ( $no_user_access ) {
wp_die( 'You do not have permission to access this page' );
}
See: https://developer.wordpress.org/reference/functions/wp_die/
Related Posts:
- How can I add an image upload field directly to a custom write panel?
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How do i best handle custom plugin page actions?
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- Export data as CSV in back end with proper HTTP headers
- Completely remove WP_Admin_Bar for specific user roles
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to Change the Entire WordPress Admin panel Look and Feel?
- Hook the Keydown Event in the TinyMCE Post Editor
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- how to use thickbox in admin?
- How do you create a custom edit.php / edit pages page
- Cancel post save
- Add a jQuery function to admin pages
- WP Cron doesn’t save or in post body
- Create a clickable name in WP_List_Table for Plugin Admin
- How to add more than 1 user role to sub-menu pages
- Check if I am in the Admin Panel (wp-admin)?
- How to add custom content under plugin row in WordPress admin plugin list?
- How to put placeholder text in the main post input area?
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- How to load the plugin only when logged in?
- How to not let a user with a new role edit users that have administrator role?
- Execute plugin for specific user role(s) only
- How to redirect to action on custom page within admin section
- WP AJAX is not working, always returns 0
- Add notification bubble notice in navigation using transients
- Hide plugin dashboard menu item for specific roles
- add a class when login
- Add a panel to edit post
- Where should I put “run once” plugin pages?
- Using the default wordpress uploader inside plugin
- Modify users.php page to create page/post on button clicked
- Issue plugin commands in admin settings page
- Any problem in using native jquery ajax style instead of using admin-ajax.php?
- Programmatically modify an admin page UI of a WordPress site from my WordPress plugin
- Problems with: manage_${post_type}_posts_columns
- Global State During an Admin Post
- Render content after post title in wp-admin
- On cliking add new post redirect user to a custom page first
- Logout users upon login, based on caps/role?
- Set different custom menu items for different user roles
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- How to add WordPress Admin “Insert Link” UI (searches through existing posts for URL) and functionality into a custom plugin?
- Admin – Handle data before creating or updating a post, page or custom post
- wp_filesystem put_contents issue with owner/group
- How can I replace content in the WP Admin area before an admin page is rendered?
- template_redirect or admin-ajax.php?
- How to load library scripts in admin from plugins in noConflict wrapper?
- wp_dropdown_roles() to replace option value = code
- Enqueue script globally
- Alternatives to DISALLOW_FILE_EDIT wp-config Constant? It Breaks Some Plugins
- How do I add a favicon that only shows during viewing of my plugin’s admin panel?
- WordPress Admin Login Custom Logo
- Hide custom post type by user roles
- 400 Bad Request, in wordpress theme development, wp_ajax
- WordPress custom post type capabilities issue
- How to import the css in the plugin admin area?
- Creating multiple wp_editer() text fields in for loop — the text/visual switch only works for first editor
- Displaying “One Time” Notification in Plugins
- Wp-admin Custom User Management
- Check user’s role and store in variable
- Admin Subpages without Menu entry
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Data not insert and update through ajax and jQuery in admin page?
- Catching Form Submission in WordPress Admin Panel
- Is it possible to load the css just on my plugin admin page?
- AJAX button with success callback. (Titan Framework)
- Disable Auto-Expanding Menu in WordPress Admin Menus
- How do I force a download in the admin area?
- Submit form to a different PHP file in the same plugin folder
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- How can I change my assigned user role in WordPress 3.5.1?
- Remove Permalink Meta Box not working?
- How do I duplicate a single post, with all its properties, and save it as a different post?
- Get cat parameter from admin-ajax
- How to make an admin plugin menu page go full screen?
- WordPress admin panel not working
- Allow contributor user role to perform copy operation PHP
- Enable a role named ‘backend_user’ to access my plugin pages
- I cant add is_admin control to plugin
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Buddy Press restrict the capability to edit users
- Change Label of custom post type
- Stop unauthorised file access
- How to enable or disable check boxes in custom post type
- Redirect with message after admin_post.php
- Remove all capabilities in separate method fails versus included in method
- How to display properly exception or echo string after posting in plugin?
- Same header/footer in Admin, across all network sites in multisite
- Get (eventual) permalink from post within Edit Post in Admin panel
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- WordPress User Management Departmental Managers
- How to add conent (text) to Add New pages form of admin in WordPress
- Forcing ALL plugin Admin menus into a separate menu
- Post data in wp-admin to external database
- WordPress multiple user roles accessing on their information on one site?
- Loading jQuery library from WordPress admin
- Remove default wordpress roles
- How to prepend a header section to all pages related to my WordPress Plugin