Hook into template_redirect
, inspect the request URI, and redirect to the return value of admin_url()
.
add_action( 'template_redirect', function()
{
$request = untrailingslashit( strtolower( $_SERVER['REQUEST_URI'] ) );
if ( 'admin' === $request )
{
wp_redirect( admin_url() );
exit;
}
});
Note: always use admin_url()
and the other built-in URL functions, because they will take care of the proper scheme (https
or http
).
Related Posts:
- Change the Default Pages Menu View in wp-admin
- Redirect from the dashboard to edit.php if wp_is_mobile() is true
- What are the standard admin CSS id/class tags?
- Modal window from within WordPress admin
- Admin Page Redirect
- How to Change the Default Home Page for the WordPress Dashboard?
- How To Remove WordPress Version From The Admin Footer
- Set Default Admin Colour For All Users
- Securing Admin Accounts – Username Discovery
- Can an admin check passwords of registered users?
- How-to make the admin area mobile friendly [closed]
- How to obtain the user ID of the current profile being edited in WP-Admin?
- 3.3: How do you hide the new dashboard welcome panel?
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- Redirect Admin User in Dashboard
- Appearance->Editor not visible
- Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?
- Admin pages have no content
- Blocking Administrative Access to Authors and Subcribers?
- How to find out if an wp-admin action edited a file?
- How to display only logged in user’s post comments in comments area
- WordPress 3.8 get current admin color scheme
- How to Use Resposive Tables in WordPress ADMIN Pages?
- How can I access profile Admin Colour Scheme
- I keep getting logged out in Firefox
- Add tabbed menu to admin page
- remove_action with profile_personal_options
- Getting the different post statuses + count like in edit.php, in a custom submenu page
- How To Create User Specific Admin User Pages?
- Conditionally load CSS/JS/PHP in wp-admin if using a mobile device
- How to disable automatic excerpt generation *in admin*?
- Limit Words in Category / Term Description – Admin Panel
- Change top level menu item to point to custom submenu item
- Admin page redirect to another admin page
- Associating custom submenu item with post type of top level menu item
- Adding text in more than one language (at the same time)
- wp-admin post.php JavaScript Links Not Working
- Super slow admin panel
- Admin Taxonomy Terms – Orderby Term Field
- How do I add an admin notice within javascript in the admin interface for posts?
- Fatal error: Exception thrown without a stack frame in Unknown on line 0
- Hide Pages on Edit Pages based on Capability (edit_others_pages)?
- WordPress Admin Login Redirect Problem
- Unable to Access WP Admin or Login buttons after Migration
- Add ‘Last Modified’ and Attachments (Yes/No) to WordPress Users Column
- Editors change a permalink on an unpublished post, but only admins change a permalink on a post that has ever been published?
- How Can I Found Admin Directory
- WordPress post feature image not uploading
- Combine and Minify wp-admin files, also re-write URI’s for CDN
- Redirect in an Admin page
- 500 internal server error on wp-admin only
- Seems that admin_post_{action} does not executing
- Add Custom Script in Other Plugin’s Options page
- When submitting the form site.com/blog/wp-admin it goes to site.com/wp-admin
- Can I host WP-admin locally for a remote blog?
- get_current_screen and the WP_Screen class
- Can’t access wp-admin, redirects to http://%24domain/wp-admin/
- Is there alternative to WP_List_Table?
- WordPress Brute Force Prevention
- Admin login not working
- Adding and removing columns from the admin pages panel
- Can’t login to my admin area
- How to make sure your admin doesn’t hi-jack you site?
- Redirect public site to another one but allow administrators to access the old site
- How to change the descriptive text on the menus admin page?
- Dynamic WordPress Admin Panel
- Wp-Admin FTPS Connection Error unlike Filezilla
- Trying to login to my site redirects me to the first page
- ‘Conflict’ with action deleted_post and is_admin()
- issue in wordpress auto delete post and redirect to another 1
- How to update my website with WordPress?
- wordpress login loop after install
- Unable to render Admin Notices
- WordPress login not working
- Admin blank but Admin menu showing
- Pages redirect me to the homepage
- Capability to read/edit page in wp-admin only for administrators
- WP Logs me out after updating anything on dashboard
- Problems in migration of WordPress site from local server to the online server
- WYSIWYG editor not in a post editor?
- htaccess and htpasswd
- plugin to upload to youtube via wordpress [closed]
- You do not have permission to access this document on form submit
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error
- Is it possible to create a WordPress tour? V3.3.1
- Is it OK to move admin menu items?
- using slug instead of ID in admin edit post url
- Taxonomy/category hierarchy lost when editing posts [closed]
- How get Themes list via REST api?
- Editing the Backend Uploader
- admin_enqueue_scripts not rending JS file correctly
- Adding prefix to WordPress database tables breaks admin capabilities?
- WordPress Plugin Admin Tab
- Parsing post->ID in included plugin file
- Gutenberg UI has changed
- Highlight active Admin Menu when added though add_menu_page
- When installing wordpress through WP CLI mysite.com/admin not working
- Adding additional text fields and image upload to a Page?
- WordPress admin panel is blank
- What Role to assign remote site developer?